Convert Flat File to ADO XML

Here's some server-side ASP script to read a flat comma-separated-values (CSV) text file into an ADO Recordset, and then save it as an XML file (for possible later use). The CSV file should have fiel

ITPro Today

February 18, 2002

1 Min Read
ITPro Today logo in a gray background | ITPro Today

Here's some server-side ASP script to read a flat comma-separated-values (CSV) text file into an ADO Recordset, and then save it as an XML file (for possible later use). The CSV file should have field names stored on the first line. You can optionally have the text file deleted after successfully saving it as an XML file.

ADO 2.5 and higher allows you to save a recordset in either a proprietary ADO format or in XML format using one line of code. Using VBScript's Split function to read a delimited line of text (read in from an MS Scripting TextStream object), allows you to add each record and all its values in one line of code.

See my tip titled "Open Server-Side XML File as ADO Recordset on Client" to see how to open the XML file from the client browser with just a few lines of code.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like