?
Solved

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

Posted on 2009-02-20
4
Medium Priority
?
359 Views
Last Modified: 2012-05-06
Hello,
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"
    CommonDialog1.ShowOpen
   
     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">
    <fhsrchResult>
        <document_name>surveillance update</document_name>
        <location>001 01 328</location>
        <type>CORR</type>
        <meta_id>3880</meta_id>
        <is_legal>YES</is_legal>
        <is_ime>YES</is_ime>
        <is_record>YES</is_record>
        <status xml:space="preserve">
        </status>
        <provider />
        <filename>001-surveillance update.pdf</filename>
        <created_date>2009-02-08T06:10:49-05:00</created_date>
    </fhsrchResult>
    <fhsrchResult>
        <document_name>HRG RPT  10-9-08</document_name>
        <location>001 01 328</location>
        <type>LEG</type>
        <meta_id>3313</meta_id>
        <is_legal>YES</is_legal>
        <is_ime>NO</is_ime>
        <is_record>NO</is_record>
        <status xml:space="preserve">
        </status>
        <provider />
        <filename>003-HRG RPT  10-9-08.pdf</filename>
        <date_of_service>2008-10-09T00:00:00-04:00</date_of_service>
        <created_date>2009-02-08T06:10:45-05:00</created_date>
    </fhsrchResult>
</fhsrchResult>

Any help would be greatly appreciated!
0
Comment
Question by:posae
  • 2
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
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

0
 

Author Closing Comment

by:posae
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!
0
 
LVL 11

Expert Comment

by:Antagony1960
ID: 23698943
Glad to have helped. :-)
0
 

Author Comment

by:posae
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?
0

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