download db data to .xls with asp
I found a script to create a comma delimited spreadsheet. I have 2 problems with it. Help if you can.
1. It will save the object as a .asp file unless you rename it. How do I tell it the file is to have the extension .xls
2. It's a comma delimited file...we have comma's in our DB. I need to know how to change it to tab delimited or something like that.
the code:
<%
'
' prepare MS ACCESS connection
'
Dim connect, rs
Dim sSQL, Conn
Set connect = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateOBject("ADODB.Recordset")
connect.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & sDataSource
connect.Open
%>
<%
sSQL = "SELECT * " & _
" FROM MasterTableCfoapal2"
set rs = Connect.Execute(sSQL)
Dim F, Head
For Each F In rs.Fields
Head = Head & ", " & F.Name
Next
Head = Mid(Head,3) & vbCrLf
Response.ContentType = "text/plain"
Response.Write Head
Response.Write rs.GetString(,,", ",vbCrLf,"")
%>
|