DataAdapter question

E

Eric A. Johnson

I'm using ADO style. I have an Access database with four tables that I will
want to do queries on. I will want to do queries on all four tables, at
least individually, and possibly at the same time (using "INNER JOIN"). My
question: Is it better to have four individual DataAdapters, one for each
table, with the DataSet linking to a different one for each query; one
single DataAdapter, that would connect to all four tables at once; or some
kind of combination of the two? Any tips? As you can tell, I'm rather a
newbie at databases.

Thanks,
Eric
 
E

Elton Wang

Hi Eric,



If you only need one result set in the application, you can just use one
join query, of course, only one DataAdapter. Even if you want to get four
DataTables in one DataSet, you can still use only one DataAdapter:



OleDbDataAdapter dap = new OleDbDataAdapter("Select * FROM TABLE_ONE; Select
* FROM TABLE_TWO; Select * FROM TABLE_THREE; Select * FROM TABLE_FOUR",
CONNECTION_STRING);

DataSet ds = new DataSet();

dap.fill(ds);



can fill into ds with four DataTables in one operation.



HTH
 

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

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top