Skip navigation

Using ADO's XML Features - 23 Dec 1999

Extensible Markup Language (XML) is hot these days. XML is important, but you need to separate the useful elements of XML from the hype. I recently received a new CD-ROM from Microsoft that demonstrates what you can do with XML and other Microsoft technologies such as SQL Server, ADO, and some non-Microsoft tools. You can find the CD-ROM, "Microsoft Windows DNA XML Resource Kit".

One particularly intriguing aspect of XML is its use in the business tier as a mechanism for moving data. You can use XML to encapsulate your data, then send that data in one or more ways between systems or users. You just need an application on either end to put the data into XML format and an application to take the data out of XML format and convert it to the format you need (such as an ADO recordset or a SQL Server database).

Technologies such as ADO really help when they include features that let you automatically write and read data to and from XML. For example, you can use ADO 2.1 and higher to write an ADO recordset to the c:\temp\myfile.xml file by using this syntax:

rs.Save "c:\temp\myfile.xml",adPersistXML

You can recreate the ADO recordset later by using this syntax with the Open method:

rs.Open 
"c:\temp\myfile.xml",,adOpenForwardOnly,adLockReadOnly,adCmdFile

ADO's XML features let you quickly read and write XML data. As a result, you can easily write applications that transport data from one place to another. For instance, a mainframe application could output data in XML format, then your Web or Visual Basic (VB) application could read that same file and automatically create an ADO recordset from it. The only catch is that the XML file format must be the format ADO expects, which I’ll discuss in a future article.

XML is here to stay. It’s powerful and you can integrate it into many applications. The trick is figuring out where and how to apply it in the most efficient manner for your application.

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