469,275 Members | 1,773 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,275 developers. It's quick & easy.

Saving DataSet as XML in ADO format using VB.NET

Hi,

I am trying to convert a lot of web reports from ASP/VB to
ASP.NET/VB.NET. I would like to save my dataset in XML and then use
XSLT to transform the XML. The catch is I would like to have the XML
in the format that ADO uses versus the default format in which ADO.NET
uses. Currently, I am using ADO within .NET, but I am concerned about
the performance and it might improve if I used the native data
providers for .NET. I am not sure if I am missing something but how do
I save the .NET DataSet to XML in the OLD ADO format?
Thanks for you help in advance and it is most appreciated.
In the old version fo the reports, the code is as follows:

Set lobjConnection = New ADODB.Connection
lobjConnection.ConnectionString = mstrConnectionString
lobjConnection.CursorLocation = adUseClient
lobjConnection.Open

Set lobjRecordset = lobjConnection.Execute(pstrSQL)
Set lobjDom = New MSXML2.DOMDocument40
lobjRecordset.Save lobjDom, 1

Set lobjXSL = New MSXML2.DOMDocument40
lobjXSL.Load (pstrXSLFilePath)
lstrHTML = (lobjDom.transformNode(lobjXSL))

The sample of XML from the old version of the reports is as follows:

<xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
<s:Schema id="RowsetSchema">
--"Schema Information"--
</s:Schema>
<rs:data>
<z:row PENDING_CODE="001" PEND_CODE_DESCR="Missing Note Date"/>
</rs:data>
</xml>

In the new version of the reports, using the native data provider, the
code is as follows:

Dim lobjDA As OracleDataAdapter
Dim lobjCmdBuilder As OracleCommandBuilder
Dim lobjDS As DataSet
Dim lobjXMLDataSet As XmlDataDocument

mobjConn = New OracleConnection(GetDSNFromCache())
mobjConn.Open()
mobjCmd = New OracleCommand(astrSQL, mobjConn)
lobjDA = New OracleDataAdapter(mobjCmd)
lobjCmdBuilder = New OracleCommandBuilder(lobjDA)
lobjDA.MissingSchemaAction = MissingSchemaAction.Add

lobjDS = New DataSet("DataSet")
lobjDS.Tables.Add("Results")
lobjDA.Fill(lobjDS, "Results")
lobjXMLDataSet = New XmlDataDocument(lobjDS)

Return lobjXMLDataSet.InnerXml

The sample of XML from the newversion of the reports is as follows:
<DataSet><Results><PENDING_CODE>001</PENDING_CODE><PEND_CODE_DESCR>Missing
Note Date</PEND_CODE_DESCR></Results></DataSet>
Nov 12 '05 #1
1 7831
Cor
Hi Shaileen,

Do not hit your desk in two when you read this.

Instead of using the DOM you can use

dataset.xmlread and dataset.xmlwrite

Very overloaded methods with schemas

I hope this helps?

Cor
I am trying to convert a lot of web reports from ASP/VB to
ASP.NET/VB.NET. I would like to save my dataset in XML and then use
XSLT to transform the XML. The catch is I would like to have the XML
in the format that ADO uses versus the default format in which ADO.NET
uses. Currently, I am using ADO within .NET, but I am concerned about
the performance and it might improve if I used the native data
providers for .NET. I am not sure if I am missing something but how do
I save the .NET DataSet to XML in the OLD ADO format?
Thanks for you help in advance and it is most appreciated.
In the old version fo the reports, the code is as follows:

Set lobjConnection = New ADODB.Connection
lobjConnection.ConnectionString = mstrConnectionString
lobjConnection.CursorLocation = adUseClient
lobjConnection.Open

Set lobjRecordset = lobjConnection.Execute(pstrSQL)
Set lobjDom = New MSXML2.DOMDocument40
lobjRecordset.Save lobjDom, 1

Set lobjXSL = New MSXML2.DOMDocument40
lobjXSL.Load (pstrXSLFilePath)
lstrHTML = (lobjDom.transformNode(lobjXSL))

The sample of XML from the old version of the reports is as follows:

<xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
<s:Schema id="RowsetSchema">
--"Schema Information"--
</s:Schema>
<rs:data>
<z:row PENDING_CODE="001" PEND_CODE_DESCR="Missing Note Date"/>
</rs:data>
</xml>

In the new version of the reports, using the native data provider, the
code is as follows:

Dim lobjDA As OracleDataAdapter
Dim lobjCmdBuilder As OracleCommandBuilder
Dim lobjDS As DataSet
Dim lobjXMLDataSet As XmlDataDocument

mobjConn = New OracleConnection(GetDSNFromCache())
mobjConn.Open()
mobjCmd = New OracleCommand(astrSQL, mobjConn)
lobjDA = New OracleDataAdapter(mobjCmd)
lobjCmdBuilder = New OracleCommandBuilder(lobjDA)
lobjDA.MissingSchemaAction = MissingSchemaAction.Add

lobjDS = New DataSet("DataSet")
lobjDS.Tables.Add("Results")
lobjDA.Fill(lobjDS, "Results")
lobjXMLDataSet = New XmlDataDocument(lobjDS)

Return lobjXMLDataSet.InnerXml

The sample of XML from the newversion of the reports is as follows:
<DataSet><Results><PENDING_CODE>001</PENDING_CODE><PEND_CODE_DESCR>Missing
Note Date</PEND_CODE_DESCR></Results></DataSet>

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Chris Huddle | last post: by
reply views Thread by Luis Esteban Valencia | last post: by
5 posts views Thread by Jason | last post: by
15 posts views Thread by Joseph Geretz | last post: by
2 posts views Thread by RobcPettit | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.