Skip to content

HELP - How to import xml data into Microsoft Access

Colin Adan

Asked Jul 9, 2006, 11:23 PM EDT2 answers
Share
LinkedInX
Hi All

I am trying to parse an XML file, strip out the data I require and insert this into a Microsoft Access Database Table. As the files are quite large, I thought about loading say the first 100 records into a DataGridView (hidden), calling a method to insert those into the database, then getting the next 100 records and so forth.

Does anyone have a clue how to do this? I can get teh data from the xml using ReadXML(), but that gives me the whole document.

If you know of a better way to go about this, I would love to hear it.

Many thanks
Col

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Mike Gold
    0
    Your probably best off using some sort of xpath strategy of just selecting the nodes you want and then inserting them into the database through the oledb classes in ADO.NET.  You can use the OleDbCommand object to insert the data into the database and the SelectNodes method with Xpath to extract the xml nodes you want to move to the db.  This is all assuming, of course, that you can somehow distinguish pieces of the document with identifying tags and attributes

    -Best,

    -Mike
    0
  • 0
    Hi Mike

    Thanks for the response. I will look into doing what you suggest.

    Thanks again
    Col
    0