With this code, you can use GetString method of recordset object to convert recordset (SQL query) to csv file. Author: Antonin Foller Code: ASP 3.0 & VBScript
|Good start but inadequate |
Written by Anonymous User (#1513-266) from Seattle, WA (Saturday, February 12, 2005)
||Strengths: Smart enough to use GetString
Weaknesses: Ignores problem of commas in data
Details: Oh, get serious!
Anybody who has ever had a CSV file with data that contains commas KNOWS that you have to put the individual fields in quote marks!
Else how can you know whether data such as
1, 2, Jones, Bill
is supposed to be seen as
1, 2, "Jones", "Bill"
1, 2, "Jones, Bill"
On top of that, this article uses
Response.ContentType = "text/plain"
That's fine for having it show up in the browser, but if you'd like the CSV to be *downloaded* then you should specify a *real* content type *and* a disposition.
Funniest part may be that the author doesn't realized that the *DEFAULT* value for the fourth argument to GetString is the same as what he used!
Review Based On: 60 Month(s) of usage