Here is a sample of code that I use, however I do not use the FP database components other than to
create the database connection and the global.asa file via the Tools | Web / Site Settings |
Database. I also only work with System DSNs. So if you use FP database component or a DSNLess
connection, I can't help you will getting the following to work.
<%
Dim DSN_Name
DSN_Name = Application("connectionname_ConnectionString")
set Connection = Server.CreateObject("ADODB.Connection")
Connection.Open DSN_Name
Dim FName
FName = "filename.csv"
Set RS = Server.CreateObject("ADODB.Recordset")
Sql = "SELECT * FROM Tablename"
Set RS = Connection.Execute (sql)
Dim F, Head
For Each F In RS.Fields
Head = Head & ", " & F.Name
Next
Head = Mid(Head,3) & vbCrLf
Response.ContentType = "application/ms-excel"
Response.AddHeader "content-disposition", "filename= " & FName
Response.Write Head
Response.Write RS.GetString(,,",",vbCrLf,"")
%>
connectionname is the name of the DSN connection.
Filename is the name that will be assigned to each CSV file created, this should be easy to change
to accept a value via QueryString, or Form post.
Tablename is the name of the table in your database, and you can change the * which dumps all fields
to specific field if needed.
--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)
FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
bobs said:
All, thanks for responding. I was looking to provide the results to users (i.e not just locally to
myself). The idea is that users can go to a FP website, select data parameters, and cut and paste
the results into Excel. The suggestion of using ODBC in Excel doesn't work well as not all users
would have OCBC connectivity/access. I've figured out how to more efficiently cut and paste the data
into Excel, however, if there as a way in which the results would allow users to "save to a file" or
post into some kind of Excel object...that would be great. Regards, Bob