Here is an extract of code from one of my applications that will export a file - the user will get the save dialogue box as webmonkey said though
if strAction = "export" then
'Output the page in plain text format
Response.ContentType = "text/csv"
Response.AddHeader "Content-Disposition", "filename=email_list.csv;"
'Connect to database and get recordset of subscriber batch
dim objRS
set objRS = Server.CreateObject("ADODB
objRS.ActiveConnection = Application("ConnectString
objRS.Source = "sp_SelectTable '*', 'Subscriber', 'SubscriberID'"
objRS.Open , , , , adCmdText
'Write out field headers
dim strField
Response.Write("'") 'Fix for Excel import
for each strField in objRS.Fields
Response.Write(strField.Na
next
Response.Write(vbCrLf)
'Write out records
do while not (objRS.BOF or objRS.EOF)
for each strField in objRS.Fields
Response.Write(strField.Va
next
objRS.MoveNext
Response.Write(vbCrLf)
loop
objRS.Close : set objRS = nothing
Response.End()
end if
Main Topics
Browse All Topics





by: WebmonkeyPosted on 2003-04-17 at 18:20:35ID: 8352039
You can, but it will -not- be transparent to the user. They will receive the SAVE/OPEN dialog. Is this acceptable? If so, I've got some code you can use.