PC Review


Reply
Thread Tools Rate Thread

dataadapter vs tableadapter - whats the difference?

 
 
HONOREDANCESTOR@yahoo.com
Guest
Posts: n/a
 
      27th Nov 2007
I have a book called "Hitchhiker's Guide to Visual Studio and SQL
Server". It has a chapter on using dataAdapters, and another chapter
on using tableAdapters. The problem is, they seem to overlap in what
they can do, and I don't know when I would use one and when I would
use the other? Furthermore VB 2003 seemed to use one, and VB 2005
seems to use the other mostly (at least when you drag and drop).
If I just want to learn the latest method of using VB-2005 with
databases, should I learn both adapters? Or just the Table Adapter?
And how would I know, in a given application, which one to choose?
Thanks,
HA
 
Reply With Quote
 
 
 
 
Scott M.
Guest
Posts: n/a
 
      28th Nov 2007
A TableAdapter is a visual component that VS uses to "show" you the details
of your connection and dataadapter. You wouldn't, for example, make an
instance of one of these in code and use it that way. A DataAdapter is
still the actual object that bridges the gap between the connected and
disconnected ADO .NET objects and, if you were writing code to perform your
data access, you'd use this.


<(E-Mail Removed)> wrote in message
news:82384dc5-a15d-4ab9-8e29-(E-Mail Removed)...
>I have a book called "Hitchhiker's Guide to Visual Studio and SQL
> Server". It has a chapter on using dataAdapters, and another chapter
> on using tableAdapters. The problem is, they seem to overlap in what
> they can do, and I don't know when I would use one and when I would
> use the other? Furthermore VB 2003 seemed to use one, and VB 2005
> seems to use the other mostly (at least when you drag and drop).
> If I just want to learn the latest method of using VB-2005 with
> databases, should I learn both adapters? Or just the Table Adapter?
> And how would I know, in a given application, which one to choose?
> Thanks,
> HA



 
Reply With Quote
 
Cor Ligthert[MVP]
Guest
Posts: n/a
 
      28th Nov 2007
Hi,

In version 2003 we had the DataAdapter and the Dataset. A part of the
dataset is the DataTable. For some who were used to the recordset that was
to difficult.

Then we got the TableAdapter as stand alone part in version 2005, because
that would be the solution, however probably not as wanted because now for
2008 we have Linq.

(Spoken this means in Dutch "tricky or dangerous").

I don't know why that name is choosen, however I am not yet able to give a
realistic opinion about Linq to be able to presume what there will be in
2011.

I know from a message the ideas of the writer of the Hitchhiker about this,
he will probably use other/more words to answer (By instance because he can
start earlier in past). However his intention will probably not be much
different.

:-)

Cor

 
Reply With Quote
 
William Vaughn
Guest
Posts: n/a
 
      30th Nov 2007
Having written the book, perhaps I should elaborate further.

A DataAdapter is a Framework class used to construct untyped DataSet objects
by populating the Tables collection with the rowsets returned by the
SelectCommand. This class also supports an Update method that permits you to
define Update, Insert and Delete Commands for a single table. While the
DataAdapter can populate a DataSet with many tables, it can only make
changes to one of these--unless you jump through some hoops as I explain in
the book.

A TableAdapter is a Visual Studio-generated class to generate strongly typed
DataTable classes--including code to update the DataTable. It is a bindable
mechanism to manage a single rowset--usually derived from a SELECT against a
single table.

While both of these mechanisms can be populated with the rowset returned by
a JOIN, they do not provide a means to update the root database Table--as
possible in some cases in ADO classic.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

<(E-Mail Removed)> wrote in message
news:82384dc5-a15d-4ab9-8e29-(E-Mail Removed)...
>I have a book called "Hitchhiker's Guide to Visual Studio and SQL
> Server". It has a chapter on using dataAdapters, and another chapter
> on using tableAdapters. The problem is, they seem to overlap in what
> they can do, and I don't know when I would use one and when I would
> use the other? Furthermore VB 2003 seemed to use one, and VB 2005
> seems to use the other mostly (at least when you drag and drop).
> If I just want to learn the latest method of using VB-2005 with
> databases, should I learn both adapters? Or just the Table Adapter?
> And how would I know, in a given application, which one to choose?
> Thanks,
> HA


 
Reply With Quote
 
Jim Rand
Guest
Posts: n/a
 
      30th Nov 2007
A much simpler explanation is a TableAdapter does a bunch of stuff. It
delegates the fill and update methods to a private DataAdapter. After using
it, I equated the TableAdapter as a DataAdapter with training wheels -
something to get started with but certainly nothing to finish with.

If you 1) use SQL Server, 2) use GetChanges() and 3) want to get the
autoincrement keys back, then you must trap the row updated event to skip
the inserts. If you don't believe this, examine the DiffGrams. While the
DataAdapter exposes these events, the TableAdapter does not. With a partial
class, you can add a public property to expose the underlying DataAdapter.



"William Vaughn" <(E-Mail Removed)> wrote in message
news:FEBBDA59-1852-4D5E-A6CF-(E-Mail Removed)...
> Having written the book, perhaps I should elaborate further.
>
> A DataAdapter is a Framework class used to construct untyped DataSet
> objects by populating the Tables collection with the rowsets returned by
> the SelectCommand. This class also supports an Update method that permits
> you to define Update, Insert and Delete Commands for a single table. While
> the DataAdapter can populate a DataSet with many tables, it can only make
> changes to one of these--unless you jump through some hoops as I explain
> in the book.
>
> A TableAdapter is a Visual Studio-generated class to generate strongly
> typed DataTable classes--including code to update the DataTable. It is a
> bindable mechanism to manage a single rowset--usually derived from a
> SELECT against a single table.
>
> While both of these mechanisms can be populated with the rowset returned
> by a JOIN, they do not provide a means to update the root database
> Table--as possible in some cases in ADO classic.
>
> --
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant, Dad, Grandpa
> Microsoft MVP
> INETA Speaker
> www.betav.com
> www.betav.com/blog/billva
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> __________________________________
> Visit www.hitchhikerguides.net to get more information on my latest book:
> Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
> and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
> -----------------------------------------------------------------------------------------------------------------------
>
> <(E-Mail Removed)> wrote in message
> news:82384dc5-a15d-4ab9-8e29-(E-Mail Removed)...
>>I have a book called "Hitchhiker's Guide to Visual Studio and SQL
>> Server". It has a chapter on using dataAdapters, and another chapter
>> on using tableAdapters. The problem is, they seem to overlap in what
>> they can do, and I don't know when I would use one and when I would
>> use the other? Furthermore VB 2003 seemed to use one, and VB 2005
>> seems to use the other mostly (at least when you drag and drop).
>> If I just want to learn the latest method of using VB-2005 with
>> databases, should I learn both adapters? Or just the Table Adapter?
>> And how would I know, in a given application, which one to choose?
>> Thanks,
>> HA

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
TableAdapter vs. DataAdapter: Ad Hoc Queries msnews.microsoft.com Microsoft ADO .NET 12 8th Aug 2008 05:14 PM
How to replace the dataAdapter with tableAdapter? snow Microsoft VB .NET 0 3rd Jul 2008 07:40 PM
difference between dataAdapter.InsertCommand/dataAdapter.SelectCom =?Utf-8?B?UmljaA==?= Microsoft VB .NET 3 10th Nov 2006 03:34 PM
TableAdapter vs DataAdapter s.bussing@symax.nl Microsoft ADO .NET 4 29th Sep 2006 10:37 PM
TableAdapter vs DataAdapter performance JRD Microsoft ADO .NET 3 30th Mar 2006 07:12 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:31 AM.