Solved

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

Posted on 2004-09-23
7
566 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

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…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month6 days, 21 hours left to enroll

622 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