473,386 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 1905
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...

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.