Solved

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

Posted on 2004-09-23
7
560 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
7 Comments
 
LVL 29

Accepted Solution

by:
leonstryker earned 125 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 125 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Using "ScreenUpdating" 6 84
Crystal reports - Formula Field code need assistance with code 17 92
IF ELSE Statement in Excel Macro VBA 16 87
Automatic Email Reminder 4 75
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

733 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