How to dump an entire db into a dataset?

S

Sai

Hi all,

I am trying to dump a small SQL Server database (whose structure I will not
know at runtime) into a dataset (structure and data) and then call writexml
on that dataset.

How can I write generic ado based code to dump out the entire database into
a dataset? All the code samples I see assume knowledge of the database
structure and the relationships between the tables. Is there a simple
command I am missing with which I can point a dataset at a database and tell
it populate itself (tables, subtables, Foreign key relations etc.)

Thanks in advance for your help

Sai
 
W

William Ryan eMVP

Hi Sai:

If you are using SQL Server you can query the Information_Schema or if you
want to do it the hard way, query the system tables to determine what tables
there are, their structure etc. ADO.NET isn't probably the tool of choice
here to accomplish this sort of stuff, you'd probably be better off writing
a DTS package or similar method b/c it'll be a lot faster and a whole lot
less cumbersome.

HTH,

Bill

--

W.G. Ryan, eMVP

http://forums.devbuzz.com/
http://www.knowdotnet.com/williamryan.html
http://www.msmvps.com/WilliamRyan/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top