p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_howto thread: download a recordset to a .csv file


Message #1 by "mark eckeard" <meckeard2000@y...> on Fri, 3 Aug 2001 20:56:19
just use getString to convert to a .CSV file and then change the content 
type and response.write the stream out.

something like....


response.buffer = true
set oConn = server.createobject("adodb.connection")
set oRs = server.createobject("adodb.recordset")
oConn.open sConnString
set oRs oConn.execute("Select fld1, fld2 from mytable")
if not(ors.eof) then
         sCSV = oRs.getString('get the correct params here)
         response.contentype = "applcation/csv"  ' ? correct content type ?
         response.write sCSV
else
         response.write "No Data"
end if



if the data doesnt change that much you could consider caching to disk

also consider using XML





At 08:56 PM 8/3/2001 +0000, you wrote:
>Hi,
>
>Does anyone know how to download a recordset into a .csv file?
>
>Thanks,
>Mark
>---


Robert Chartier
Author and Developer
xxx-xxx-xxxx
rob@a...
http://www.aspfree.com/devlinks
http://www.aspfree.com/authors/robert
http://www.aspalliance.com/nothingmn


  Return to Index