Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ASP.NET web service returns dataset.GetXML to ADODB.Recordset compliant xml

Posted on 2004-09-23
7
Medium Priority
?
588 Views
Last Modified: 2013-12-25
My VB6 application uses MSSOAPLib to call a method of an ASP.NET webservice which returns an xml string of a dataset using the dataset.GetXML() method. How would I convert this xml string to a recordset?

Would I also need the schema information, dataset.GetXMLSchema()?

Thanks ~
Vincent
0
Comment
Question by:lunarknight
  • 2
  • 2
4 Comments
 
LVL 29

Accepted Solution

by:
leonstryker earned 500 total points
ID: 12137567
Try this:

'From: http://abstractvb.com/code.asp?A=814

Add a reference to MSXML then drop this code in a module. Just call the XMLStringToRecordset function passing in a valid XML document. (Note: the documents format must match a format defined by Microsoft.)

Public Function XMLStringToRecordset(strXML As String) As Recordset
    Dim objStream As ADODB.Stream
    Dim oRecordset As ADODB.Recordset
   
    Set objStream = New ADODB.Stream
   
    objStream.Open
    objStream.WriteText strXML
    objStream.position = 0
   
    Set oRecordset = New ADODB.Recordset
    oRecordset.Open objStream
   
    objStream.Close
    Set objStream = Nothing

    Set XMLStringToRecordset = oRecordset

    Set oRecordset = Nothing
End Function

0
 
LVL 26

Assisted Solution

by:Rejojohny
Rejojohny earned 500 total points
ID: 12154768
dataset.getxml returns records in xml format which is in a different format than what is expected by recordsets ... when u do a save of a recordset to an xml format .. all the columns of a particular record gets added as attributes and a node/element is created for each record. but in the case of dataset.getxml, i think the columns gets formatted as nodes of a parentnode instead of attributes .. so what "leonstryker" suggested might not work .. just check it out . another option would be to loop thorugh the xml string and create the recordset dynamically ..
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 12816475
Please do have a look at my comments .. i tried it out later and indeed getxml works the way i have mentioned .. so he has to loop through the xml string to create the recordset ..
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 12972209
I believe there should be a split between

leonstryker and Rejojohny
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question