Solved

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

Posted on 2004-09-23
7
553 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

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…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…

786 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