dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: query with blank spaces

  1. #1
    Join Date
    Sep 2003
    Posts
    651

    query with blank spaces

    I have a function that I pass in an sql statement.

    How can I pass into the sql that I want blank spaces between some of the fields?

    sub outputexcel(sql)
    'response.write sql
    randomize
    nRandom = (100-1)*Rnd+1
    fileExcel =monthname(month(date)) & cstr(year(date)) & "_" & CStr(nRandom) & ".xls"
    filePath= Server.mapPath("admin.asp")
    filepath=mid(filepath,1,len(filepath)-9)
    'response.write "filepath:" & filepath & "<br>"
    filename=filePath & "excelfiles\" & fileExcel
    'response.write filename
    Set fs = Server.CreateObject("Scripting.FileSystemObject")
    Set MyFile = fs.CreateTextFile(filename, True)

    Set rs = objconn.Execute(sql)

    strLine="<table><tr>" 'Initialize the variable for storing the filednames

    For each x in rs.fields
    strLine= strLine & "<td>" & x.name & "</td>"
    Next
    strline=strline&"</tr>"
    MyFile.writeline strLine

    Do while Not rs.EOF
    strLine="<tr>"
    for each x in rs.Fields
    cell=x.value
    strLine= strLine & "<td>" & cell & "</td>"
    next
    strline=strline & "</tr>"
    MyFile.writeline strLine
    rs.MoveNext
    Loop
    myfile.writeline "</table>"
    MyFile.Close
    Set MyFile=Nothing
    Set fs=Nothing

    link="<A HREF=excelfiles/" & fileExcel & " class=adminmenu target=_new>Click Here to Open Excel</a>"
    Response.write "<br>Excel File Created<br><br>" & link


    end sub

  2. #2
    Join Date
    Dec 2004
    Posts
    8,637
    Blank spaces where? Give a hardcoded example.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles