TableAdapter for Strongly Typed DataSets

Posted Wednesday, March 2, 2005 1:10 PM by C-Dog's .NET Tip of the Day
The TableAdapter is a new component brought to us by Visual Studio 2005.  This is basically the strongly typed equivalent of a DataAdapter.   When you create a new typed dataset now, the wizard aks if you would like to add any methods.  By default, there are methods available that allow you to fill a DataTable, return a DataTable, as well insert/update/delete directly from a database. 
When you opt to create a Fill method for example, it then asks you to specify a query or stored procedure.  You can even create multiple methods to fill by different parameters (i.e.: different id columns).
When you create the new dataset, besides the dataset there will be a table adapter class created for each table.  For example, if we have a dataset called DealsDataSet and it has a datatable called Deals, a TableAdapter would be created called DealsTableAdapter.  If we create a Fill method that filled the DataTable by ContentId, a statement to fill the table would look like this:
These new DataSet methods should prove to be useful any time we have simple Sql data access requirements as it will allow us to cut out a lot of ADO.NET code.

Read the complete post at