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 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.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish