KBD

Keith Devens .com

Saturday, August 30, 2008 Flag waving
The great dividing line between success and failure can be expressed in five words: "I did not have time." – WestHost weekly newsletter 14 Feb 2003
← Dynamic Code Compilation in C#ConnectionStrings.com →

Daily link icon Thursday, February 23, 2006

TableAdapter vs DataAdapter

If you're not sure whether to use a TableAdapter or a DataAdapter, this tells you which one you should use:

The typical Visual Studio mechanism for executing Transact-SQL queries and for filling datasets is the TableAdapter.

You can execute SQL statements or stored procedures against a data source using TableAdapters or command objects (for example, SqlCommand). To load data into datasets created using design tools in Visual Studio, use TableAdapters. To load data into datasets created programmatically, use data adapters. If your application does not use datasets, use command objects to execute SQL statements or stored procedures directly against a database.

If you create a dataset with a Visual Studio design-time tool (such as the Dataset Designer or the Data Source Configuration Wizard), then you use a TableAdapter to fill it. TableAdapters execute your SQL statements or stored procedures.

If you create a dataset without design-time tools, then you must use data adapters to fill and update data. (TableAdapters are not actual classes in the .NET Framework, so they are not suitable for working with datasets that have been created without the use of design-time tools. For more information on loading data into datasets with either TableAdapters or data adapters, see How to: Fill a Dataset with Data.

← Dynamic Code Compilation in C#ConnectionStrings.com →

Comments XML gif

24.185.80.219 wrote:

Great explanation. Thanks a lot.

∴ 24.185.80.219 | 10-Apr-2006 4:50pm est | #9388

steve wrote:

clear and sharp. It would save a lot time me, if I have found that earlie, when tried explain myself misteries with tableadapters Smiley

∴ steve | 19-Jun-2006 5:06pm est | #9521

Arnaud Weil (http://www.aweil.fr) wrote:

Now, the problem is that TableAdapters and DataAdapters do the same. Why didn't Microsoft use the DataAdapter class when the code is generated by Visual Studio?

I'm now having a headache making a tool that would use generated TableAdapters, since they do not inherit any class nor implement any interface...

∴ Arnaud Weil | 20-Jul-2006 4:32pm est | http://www.aweil.fr | #9564

rg wrote:

Hi can you use datasets to save the data back to the external database like access/sql without using a stored proc or a command? Like exporting to XML or any other way.

I've inserted data to the dataset (some in diffrent tables in the dataset) and there's +- 150 columns in each table.

At the end i want to save all the newly added or updated data back to the data base.

Building a command for that is a long and painfull method.
(the command builder is not really working the way i want it to work) :-(

Is there a way to do this?

TIA

∴ rg | 2-Mar-2007 3:43am est | #9992

Sergio wrote:

Hi
If I use VS2005 I have wizards, so why not use them?? I will be glad to use table adapters beacuse they are really easy to use and build. I guess the untyped datasets are death

Take a look to this problem, I have a lot of typed datasets buid on vs2003 and sqlDataAdapters too, I can still working like before creating components and dragin on them dataadapeters and creating dataset in the old fashion way. The question is tableAdapters are faster? At the execution spedd ? or the performance is just like the old SqlDataAdapter?,

Resume: What to use? sqlDatAdapters or tableAdapters ? which one is faster at execution time?

Bye

∴ Sergio | 31-Mar-2007 11:40am est | #10034

nige wrote:

thanks so much for this. Info like this saves me soo much needless mucking around.

cheers.

∴ nige | 20-May-2007 12:19am est | #10104

Feel free to post a comment below. Please see my comment policy.

Formatting Rules (No HTML):

  • **bold**, *italic*, _underlined_, --strikeout--
  • "text"="url" creates a link, and URLs are auto-highlighted
  • Blockquote: Like e-mail, begin paragraph with > (greater-than sign)
  • Lists: begin paragraph with *,-, or + (unordered), or # (ordered)
  • Code block: ?!code:language=perl|php|sql|javascript|etc.{\n}...{\n}?!/code

:
(will be your IP address if blank)
: (optional)
(Will not be shown on site)

: (optional)
:

August 2008
SunMonTueWedThuFriSat
 12
3456789
10111213141516
17181920212223
24252627282930
31 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 2 posts

Recent comments XML

new⇒Girls, please don't get breast implants

http://when-3.ofawyib.net​http://girls-24.iniexka.net​http://swingers-4.emy...

Henry: Aug 30, 4:15am

new⇒Johnny Walker Blue Label

Wow, thanks for the scotch review​:D

Lagavulin and Laphroaig are​some of...

Keith: Aug 29, 3:35pm

Generated in about 0.221s.

(Used 8 db queries)

mobile phone