Writing Dataset to XML in .Net and then Reading in VB6

Posted on 2009-02-20
Medium Priority
Last Modified: 2012-05-06
I have an application written in vb.net using VS 2008.  It creates a data set and then writes the data to an xml file using DATASET.DATATABLE.WriteXML("filename")

I need to read this xml file in VB6 to load into a datagrid and I am running into some issues.  in my VB6 app I simply have the following to open the xml file and check to see if it loads.  No Matter what I do, I keep getting an error when loading of "Invalid at the top of the Document"

Private Sub Form_Load()
    Dim oDom As New MSXML2.DOMDocument40
    Dim bOK As Boolean
    CommonDialog1.Filter = "*.xml|*.xml"
     If (CommonDialog1.FileName = "") Then Exit Sub
    bOK = oDom.loadXML(CommonDialog1.FileName)
    If Not bolResult Then MsgBox oDom.parseError.reason
    Exit Sub
End Sub

Here is the XML file contents:

<?xml version="1.0" standalone="yes"?>
<fhsrchResult xmlns="http://tempuri.org/fhsrchResults.xsd">
        <document_name>surveillance update</document_name>
        <location>001 01 328</location>
        <status xml:space="preserve">
        <provider />
        <filename>001-surveillance update.pdf</filename>
        <document_name>HRG RPT  10-9-08</document_name>
        <location>001 01 328</location>
        <status xml:space="preserve">
        <provider />
        <filename>003-HRG RPT  10-9-08.pdf</filename>

Any help would be greatly appreciated!
Question by:posae
  • 2
  • 2
LVL 11

Accepted Solution

Antagony1960 earned 2000 total points
ID: 23693959
LoadXML is for parsing an existing string rather than a file, so you need to use oDom.Load rather than oDom.LoadXML


Author Closing Comment

ID: 31549270
Wow...I guess I should have started off my post with "I don't know anything about programming..."

thanks a lot for your help!
LVL 11

Expert Comment

ID: 23698943
Glad to have helped. :-)

Author Comment

ID: 23701161
Ok...now that I have loaded the xml file, is there an easy way to just load the information into a record set?

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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 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…
Suggested Courses
Course of the Month17 days, 4 hours left to enroll

862 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