Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export Access Data to Text or XML

Status
Not open for further replies.

jasonp45

Programmer
Aug 23, 2001
212
US
Hi. I want to programmatically export from an Access table to either text or XML (I'd like to be able to do both). I'm using VB.NET on Windows XP. Any code appreciated.
 
The concept is pretty easy -- write some SQL to extract the data you're interested in, load it into a DataSet object, and then use the GetXml() method to extract it in XML format. Works for a reasonable amount of data (< 2000 rows).

For large amounts of data, you'll have to write more code -- I would suggest that you write a query to extract the primary keys of the data you want exported, then loop thru the list, running a query for each to pull the full record back. You can then use the GetXml() method again, and append it to your export file.

In order to give you the ability to output either XML or a text file, you would run it thru one of two XSLT transformations. Here's a link to one that converts XML to a CSV format:


Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Thanks. I guess I should have provided more details...what I'm trying to do is pump out up to a million rows so I can put it into SQL Server. I'm considering using text so I can avoid DTS and instead use BCP or mass insert. So I'm wondering if there is some analogous fast text-dumping feature in Access.
 
Sorry, I'm not an Access expert. I would think MS-Access (the product) might have something for this.

Chip H.


____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top