|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
ADO.NET (Clear some things up for me)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 "aziz001DETESTSPAM@googlemail.com" <aziz***@googlemail.com> schrieb Yes, usually one DataAdapter per table.> 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 You could use many DataTables per DataAdapter, but all DataTables would have> DataAdaptor? e.g. (dtCustomer, dtProducts, dtPrices). 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 Yes. One DataAdapter is there to synchronize a DataTable with the table in> represents the database file, the dataAdapters are the intermediate > 'link' to each table and the DataTables are the database tables held in > VB memory? the database. > so I should modify the DataTables and when done save them using the You can be even more certain if you ask additional ADO.Net questions in 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 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 Thanks, didn't know of the ADO.NET group 'till now. :)
-- Burning_Ranger Azis,
> Not necessary, if your dataset contains more tables than you can use one > 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? > and tell what table you want to use. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatacommondatatablemappingclasstopic.asp > 2. If there is 1 dataAdaptor per table, is there one Datatable per Yes> DataAdaptor? e.g. (dtCustomer, dtProducts, dtPrices). > > 3. Am I right in thinking that in VB, the database connection Yes and no. The dataadapter is to get and update the part of the datatable > 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) > 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 |
|||||||||||||||||||||||