Newbie question: Fill dataset will ALL tables from database

P

Pierre van Rooyen

I am a C# developer in ADO.NET and need assistance with a – I assume –
simple question:

How do I get all the data from a database in a dataset? I want to be
able to open any kind of ODBC database and thus do not have any
knowledge of the names of the tables or fields contained in the
database. I could after a day of searching on the Internet not find
ONE example where you don't have to specify which tables you want your
dataset to be populated with.

Thanks in advance
 
G

Guest

select * from all_tables is the correct Oracle syntax, I'm not sure if this will work on SQL Server or Access.

Keep in mind that multiple DataTable's are not designed to hold a whole database. There is absolutly no logical reason why you should have to put a whole database in a DataSet.You should change your approach, you'll be loading potentially millions of records into memory. Besides, ADO is designed to hold no more than 500 records, I'm not sure if it will hold much more than that

Good luc
Mark
 
C

--CELKO--

I want to be able to open any kind of ODBC database and thus do
not have any knowledge of the names of the tables or fields [sic]
contained in the database. <<

You can get to the schema information tables and read them, since they
have standardized names and structures, then you use them to discover
the stuff in the database. It is insanely complicated. The best
answer is that you actually should know what you are doing before you
do it.
 
C

Cor Ligthert

Hi Piere,

You should write a SQL statement to investigate all the tables in your
database.
and execute that with a command.executeQuery

And than make a select for every table.

There is not a SQL statement.
Select * from * as far as I know.
However my knowledge of SQL is fair, because I hate it.

Than I think you can even do when you set the names in a table
\\\
For i as integer = 0 to myTalblenameArray.length - 1
dataadatper.fill(dataset, myTablenameArray(i))
next
///
I hope this helps?

Cor
 

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

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top