How to dump an entire db into a dataset?

  • Thread starter Thread starter Sai
  • Start date Start date
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
 
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/
 
Back
Top