load simple XML into ADO recordset

  • Thread starter Thread starter Skeeve
  • Start date Start date
S

Skeeve

Folks,

I've been trying to get this to work for more than a day now. It
drives me crazy!!

This is example code from MSDN and it just doesn't work for me:

Dim adoConn As ADODB.Connection
Dim adoRS As ADODB.Recordset

adoConn = New ADODB.Connection()
adoRS = New ADODB.Recordset()

adoConn.Open("Provider=MSDAOSP; Data
Source=MSXML2.DSOControl.2.6;")
adoRS.Open("c:\tmp.xml", adoConn)

The error I get all the time is:

Object reference not set to an instance of an object

and it applies to this line:

adoRS.Open("c:\tmp.xml", adoConn)

Well, if you ask me, adoConn is an instance of an object and adoRS is
as well.

Any help greatly appreciated! I need to read a simple XML file into a
recordset for binding it to a datagrid.

Thanks,
Torsten
 
I've seen this error when the XML is not ADO classic conformant. I have a
new article (to be published in October) on this but the MSDN article gets
you there most of the way.Where did the XML come from?

--
____________________________________
Bill Vaughn
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
William \(Bill\) Vaughn said:
I've seen this error when the XML is not ADO classic conformant. I have a
new article (to be published in October) on this but the MSDN article gets
you there most of the way.Where did the XML come from?

Hi,

The XML comes from Navision and is sent as a stream. I read this
stream into a DOM (there is no other way to do it because of the COM
objects that I use to communicate with Navision).

SO I have this simple XML file in the DOM and I want it to be
converted into a recordset or dataset for binding it to a datagrid.

In the meantime, I totally skipped that idea. I now navigate through
the XML DOM and create the table dynamically (manually). But that
gives me the next problem. But that's a different story. I just posted
a message in
microsoft . public . dotnet . framework . aspnet . buildingcontrols

I would have provided the link but google didn't refresh the messages
yet.

Thanks,
Torsten
 
Back
Top