473,473 Members | 2,255 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

VB.NET DataAdapter question

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
Oct 17 '05 #1
3 1908
Hi,

I hope that I understood you question correctly, If no please correct
me, so here is the story:
one
single DataAdapter, that would connect to all four tables at once;
If you have a dataset with several tables, you can't do an inner join
in the query and let the adapter Fill method to distribute the results
between the tables, you probably ask why can't I ? Because the
DataAdapeter treats the data retruned from the db as a single table so
it wont distribute it between diffrent tables.
Is it better to have four individual DataAdapters, one for each
table, with the DataSet linking to a different one for each query;


Probably this is the way to go, at least it will work correctly.

Hope it helped.

Oct 17 '05 #2
Eric,

Will you be so kind next time not to multipost. Crossposting to more
relevant newsgroups in one time is not any problem at all.

Than at least I would have seen in the language.vb newsgroup the answer from
Alex and not have taken time to explained that part anymore.

Thanks in advance.

Cor
Oct 17 '05 #3
Eric:

The answer to your question lies in part on the type of databases you are
using. From my understanding, Microsoft Access does not support batching
whereas sql server and oracle for example do. So if Access is the database,
then I don't think it's an option. Assuming that such option was available.
For select statement, then there is benefit to batching the select
statements. You will need to possibly set TableMappings and columnmappings
if they don't match (the names) but if tablenames and colum names match,
then there is no issue. However if you only had one adapter for everything,
then you'd need to change the update/insert/delete commands for each update
which is not easy on the eyes to read. So all in all, having separate
adapters is best. Also, because of relations, the order in which you update
is most important for you do not wnat to commit constraint violations. If
you use datarelation in dataset between table, then constraints can be
enforced client side which is much good.

One thing you do not want to do though is join the table at server IF you
have to update. For read only situations, it is ok, but if you must update,
then it can be as they say, nightmare. Why? Because you can not use
commandbuilder , which is not all that good. You can not use configuration
wizard - which only matters if you don't have real data layer. But doing
what they call 'rolling your own' update logic is very very hard with joined
table - whereas doing it with separate tables and separate adapters is
simply matter of calling update on each adapter and passing in each
datatable to appropriate adapter.

For me, I would create four adapters, one dataset and four tables with
relations between them. Then, when update comes, start with parent most
table, call update on it and so forth down the ranks through children -
unless not all tables are related, if they aren't, then order of update does
not make difference for them.
"Eric A. Johnson" <no*****@dontlookforme.com> wrote in message
news:%5****************@newssvr12.news.prodigy.com ...
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

Oct 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Stephen Noronha | last post by:
I have a question, please correct me if I am wrong. I am assuming that a dataadapter establishes a connection and after filling the dataset or datatable or whatever, will close the connection to...
13
by: Doug Bell | last post by:
Hi, I thought I had this sorted this morning but it is still a problem. My application has a DataAccess Class. When it starts, it: Connects to a DB (OLE DB) If it connects it uses an...
7
by: Max | last post by:
I've included the needed tables in the DataSource. Those tables that are bound to controls I can workwith. But how do you get access to the DataAdaptors that are not bound? me.Dataset1.table...
4
by: George | last post by:
Got a question about the side effect of DataAdapter.Update() and DataTable.GetChanges(). Say I set up a DataTable and a DataAdapter in a class. Delete (Not remove) a row in the data table and...
3
by: Rich | last post by:
What is the diffeence bewtween a dataAdapter.InsertCommand and dataAdapter.SelectCommand (and dataAdapter.UpdateCommand for that matter)? Dim da As SqlDataAdapter conn.Open da.SelectCommand =...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.