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

Posted on 2009-02-20
Last Modified: 2012-05-06
I have an application written in 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="">
        <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
    LVL 11

    Accepted Solution

    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

    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

    Glad to have helped. :-)

    Author Comment

    by:posae that I have loaded the xml file, is there an easy way to just load the information into a record set?

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
    Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
    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…
    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…

    730 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now