Download A Recordset as a CSV file
- Home
- ASP
- Download A Recordset as a CSV file
You can use GetString method of recordset object to convert recordset (SQL query) to csv file :
<%
Dim RS, SQL, Conn
SQL = "Some query ...."
Set RS = Conn.Execute (SQL)
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,"")
%>
asp recordset csv MDB DBF howto reference examples samples source code demos tips