Working with Distributed Transactions

Bridging the Gap Between XML and Data Access

XML is one of the hot technologies in the development world right now. I was at a major local bookstore today and was amazed at the number of XML books on the shelves. If it wasn't the largest category in the computer section, it was a close second.

You can use an XML document to store data such as information about a series of customers and each customer's order history. In some ways, an XML document is similar to an ADO.NET DataSet or an ADO Recordset. Each object can store multiple pieces of data in a well-defined structure.

With previous development technologies such as Microsoft Visual Basic or Microsoft Active Server Pages (ASP), developers traditionally used either XML or a data access technology such as ADO, but rarely both. Why? The technologies don't really work together. You can't easily move between an XML document and an ADO Recordset.

Technically, ADO 2.1 introduced features that allow you to save the contents of a Recordset as XML and later reload that XML data into a Recordset. However, if you examine the contents of the XML file that ADO creates, you'll find that it includes a series of schema tags. There is no way to control the schema for the XML document that ADO creates. Also, ADO cannot read generic XML documents. Unless you generate your XML document using the (undocumented) schema that ADO expects, you can't load the data into a Recordset using the Recordset object's Open method.

One major goal of the ADO.NET development team was to bridge the gap between XML and data access so that you can easily integrate the two technologies. Loading data from an XML document into an ADO.NET DataSet and vice versa is simple. If you're working with SQL Server 2000, you can retrieve data from your database as XML and store the results in an ADO.NET DataSet or an XML document. You can also synchronize an ADO.NET DataSet and an XML document so that the changes made in one are visible in the other.

Let's take a closer look at these features.



Microsoft ADO. NET Core Reference
Microsoft ADO.NET (Core Reference) (PRO-Developer)
ISBN: 0735614237
EAN: 2147483647
Year: 2002
Pages: 104
Authors: David Sceppa

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net