vb.net / ado.net design question 
Author Message
 vb.net / ado.net design question

I am not clear on the best way to design data access for a desktop app with
dot net and ado.net. I am using disconected recordset, connecting to an
offsite server over the internet.

If my project opens 15 tables and updates all 15 of them, is the
correct way to have 15 different data adapters that I keep until I update
the tables, or is there a better way ?

With VB6 and ADO, when I wanted to update the record set I could just do:

Set rs.ActiveConnection = conn
rs.UpdateBatch

All I needed was the connection string and the record set. I could put this
all in one simple function, and just pass the record set and connection
string to the function and that was that.

But with vb dot net and ado.net it seems like you need a data adapter for
each data set. It is not all that terrible to keep track of both a
dataadapter and a dataset, but I am wondering if I am missing some important
concept or design technique.

I am using a dataset for each record set. Not sure if this is the best way
to do it either.



Sat, 12 Feb 2005 01:55:29 GMT  
 vb.net / ado.net design question
Quote:
> I am not clear on the best way to design data access for a desktop app
with
> dot net and ado.net. I am using disconected recordset, connecting to an
> offsite server over the internet.

Disconnected recordset?  No such thing in ADO.NET.  Are you sure you are not
using ADO?

Quote:
> If my project opens 15 tables and updates all 15 of them, is the
> correct way to have 15 different data adapters that I keep until I update
> the tables, or is there a better way ?

Data adapters are only used to fill tables.  They can be disposed after
filling the table.  When you go to save the DataSet, you can then build your
Command objects and add the SQL for updates.  My practice is to store the
connection string and the SELECT SQL in the Extended properties of the
DataTable.  I can add other things to the tables, such as INSERT, UPDATE,
and DELETE SQL, and SqlClient Parameter arrays that allows me to pass in a
DataSet to a middleware method, which then saves the table changes in the
order I specify.  It is a big timesaver to create a DLL that can create a
DataSet and update it.  Saves writing a lot of code over and over.

Quote:
> With VB6 and ADO, when I wanted to update the record set I could just do:

> Set rs.ActiveConnection = conn
> rs.UpdateBatch

You can still do pretty much the same in ADO.NET.  ADO.NET just gives more
control over what ADO and VB6 did.

Quote:
> All I needed was the connection string and the record set. I could put
this
> all in one simple function, and just pass the record set and connection
> string to the function and that was that.

I pass a DataSet to a function and it saves the changes.

Quote:
> But with vb dot net and ado.net it seems like you need a data adapter for
> each data set. It is not all that terrible to keep track of both a
> dataadapter and a dataset, but I am wondering if I am missing some
important
> concept or design technique.

Using a dataadapter for each table is a good idea, but they do not have
exist after filling the table.

Quote:
> I am using a dataset for each record set. Not sure if this is the best way
> to do it either.

A DataSet can hold multiple Datatables.  Good practice is to have your
Datatables mirror the tables in the database, and use DataRelations to
related tables together.  Much like DataShaping in ADO.

Jeff Jones



Sat, 12 Feb 2005 03:07:35 GMT  
 vb.net / ado.net design question
You can put all of your DataTables in one DataSet.

HTH,

--
Kevin Spencer
Microsoft FrontPage MVP
Internet Programmer
For ASP Tutorials and Information -
http://www.takempis.com


Quote:
> I am not clear on the best way to design data access for a desktop app
with
> dot net and ado.net. I am using disconected recordset, connecting to an
> offsite server over the internet.

> If my project opens 15 tables and updates all 15 of them, is the
> correct way to have 15 different data adapters that I keep until I update
> the tables, or is there a better way ?

> With VB6 and ADO, when I wanted to update the record set I could just do:

> Set rs.ActiveConnection = conn
> rs.UpdateBatch

> All I needed was the connection string and the record set. I could put
this
> all in one simple function, and just pass the record set and connection
> string to the function and that was that.

> But with vb dot net and ado.net it seems like you need a data adapter for
> each data set. It is not all that terrible to keep track of both a
> dataadapter and a dataset, but I am wondering if I am missing some
important
> concept or design technique.

> I am using a dataset for each record set. Not sure if this is the best way
> to do it either.



Sat, 12 Feb 2005 03:28:18 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Newbie question (ado.net / vb.net)

2. ADO.NET with ASP.NET using VB.NET

3. Design questions - VB.NET

4. ADO.Net to fetch ActiveDirectory this function bugs in Asp.net but works in Vb.n

5. what create table using ADO.NET to VB.NET

6. VB.Net, Classes and ADO.Net guidelines???

7. VB.Net => Ado.Net = Stored Procedure

8. Memory leak! (ADO.NET, VB.NET)

9. ADO.net VB.net and Oracle

10. VB.Net and Ado.Net Help Please!!!!

11. Dummies guide to ado.net for vb.net???

12. I can not INSERT into Access95 using ADO.net and VB.NET

 

 
Powered by phpBB® Forum Software