473,326 Members | 2,136 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,326 software developers and data experts.

ADO.NET (Clear some things up for me)

I've been following some tutorials and reading books and have a basic
grasp of the fundamental ADO.NET commands. But all the books I've read
use a database with only 1 table. My database has many, so:

1. I know there is 1 OleDbConnectino object variable per database
file, but is there one dataAdapter per table/query? (e.g. my tables:
tblCustomer, tblProducts, tblPrices etc etc, so should I have
dataAdapters such as these? daDataAdapterCustomer,
daDataAdapterProducts etc etc?

2. If there is 1 dataAdaptor per table, is there one Datatable per
DataAdaptor? e.g. (dtCustomer, dtProducts, dtPrices).

3. Am I right in thinking that in VB, the database connection
represents the database file, the dataAdapters are the intermediate
'link' to each table and the DataTables are the database tables held in
VB memory?
so I should modify the DataTables and when done save them using the
DataAdapter Update command to save them? (e.g.
daDataAdapterCustomer.Update(dtCustomer)

Sorry I know these are basic questions but I'd like to be 100% certain
before moving on to do more ADO.NET

Mar 21 '06 #1
3 1387
"az***************@googlemail.com" <az*****@googlemail.com> schrieb
I've been following some tutorials and reading books and have a
basic grasp of the fundamental ADO.NET commands. But all the books
I've read use a database with only 1 table. My database has many,
so:

1. I know there is 1 OleDbConnectino object variable per database
file, but is there one dataAdapter per table/query? (e.g. my tables:
tblCustomer, tblProducts, tblPrices etc etc, so should I have
dataAdapters such as these? daDataAdapterCustomer,
daDataAdapterProducts etc etc?
Yes, usually one DataAdapter per table.
2. If there is 1 dataAdaptor per table, is there one Datatable per
DataAdaptor? e.g. (dtCustomer, dtProducts, dtPrices).
You could use many DataTables per DataAdapter, but all DataTables would have
the same type, i.e. daCustomer can serve dtCustomerA, dtCustomerB etc.,
where dtCustomerA holds the customers starting with "A" and dtCustomerB
holds the customers starting with "B" (assuming the SelectCommand has a
parameter filtering records by name).

Pseudo code:

Dim dtCustomerA, dtCustomerB

set daCustomers.SelectComamnd parameter value to "A%"
daCustomers.fill(dtCustomerA)

set daCustomers.SelectComamnd parameter value to "B%"
daCustomers.fill(dtCustomerB)
3. Am I right in thinking that in VB, the database connection
represents the database file, the dataAdapters are the intermediate
'link' to each table and the DataTables are the database tables held in
VB memory?
Yes. One DataAdapter is there to synchronize a DataTable with the table in
the database.
so I should modify the DataTables and when done save them using the
DataAdapter Update command to save them? (e.g.
daDataAdapterCustomer.Update(dtCustomer)

Sorry I know these are basic questions but I'd like to be 100% certain
before moving on to do more ADO.NET

You can be even more certain if you ask additional ADO.Net questions in the
ADO.Net group: (because ADO.Net is not tied to VB.Net; you will benefit from
the none-VBers, too)

microsoft.public.dotnet.framework.adonet
Armin

Mar 21 '06 #2
Thanks, didn't know of the ADO.NET group 'till now. :)

--

Burning_Ranger

Mar 21 '06 #3
Azis,

1. I know there is 1 OleDbConnectino object variable per database
file, but is there one dataAdapter per table/query? (e.g. my tables:
tblCustomer, tblProducts, tblPrices etc etc, so should I have
dataAdapters such as these? daDataAdapterCustomer,
daDataAdapterProducts etc etc?
Not necessary, if your dataset contains more tables than you can use one
and tell what table you want to use.

http://msdn.microsoft.com/library/de...classtopic.asp
2. If there is 1 dataAdaptor per table, is there one Datatable per
DataAdaptor? e.g. (dtCustomer, dtProducts, dtPrices).

Yes
3. Am I right in thinking that in VB, the database connection
represents the database file, the dataAdapters are the intermediate
'link' to each table and the DataTables are the database tables held in
VB memory?
so I should modify the DataTables and when done save them using the
DataAdapter Update command to save them? (e.g.
daDataAdapterCustomer.Update(dtCustomer)

Yes and no. The dataadapter is to get and update the part of the datatable
as you have told you want. Important to know is that it is not a continious
link. It is everytime a one time action. That in opposite of AdoDB.

For the rest take the advice from Armin about the AdoNet group for this kind
of questions.

Cor
Mar 21 '06 #4

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

Similar topics

6
by: ritesh | last post by:
Hi, I have been reading some text on C and C++ (i.e advanced books). One of the books mentioned that C++ requires a runtime support whereas C does not - what the author was trying to say was...
7
by: N/A | last post by:
Hi all, I am learning Python. Just wondering how to clear saved memory in Python? Like in Matlab I can simply use "clear all" to clear all saved memory. Thank u!
4
by: Russell Warren | last post by:
I'm guessing no, since it skips down through any Lock semantics, but I'm wondering what the best way to clear a Queue is then. Esentially I want to do a "get all" and ignore what pops out, but I...
18
by: Marko.Cain.23 | last post by:
Hi, I create a dictionary like this myDict = {} and I add entry like this: myDict = 1 but how can I empty the whole dictionary? Thank you.
35
by: Lee Crabtree | last post by:
This seems inconsistent and more than a little bizarre. Array.Clear sets all elements of the array to their default values (0, null, whatever), whereas List<>.Clear removes all items from the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.