By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,591 Members | 629 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,591 IT Pros & Developers. It's quick & easy.

data adaptor not available

P: n/a
Since upgrading from .NET 2003 to .NET 2005, I've had a few problems
adjusting. One, I seem unable to get around is not having the
DataAdaptor available to me from the tool box. It appears I only have
DataSets and TableAdaptors available to me. In the code behind section,
I'm unable to update my information to the database simply because I
don't have the DataAdaptor.update available to me. I attempted
TableAdaptor.update() but can't seem to get the right parameters to
satisfy it. Has anyone used a method that works to update or add new
records using DataSets and TableAdaptors?

Nov 27 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi,

<bi*********@gmail.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com...
Since upgrading from .NET 2003 to .NET 2005, I've had a few problems
adjusting. One, I seem unable to get around is not having the
DataAdaptor available to me from the tool box. It appears I only have
DataSets and TableAdaptors available to me. In the code behind section,
I'm unable to update my information to the database simply because I
don't have the DataAdaptor.update available to me. I attempted
TableAdaptor.update() but can't seem to get the right parameters to
satisfy it. Has anyone used a method that works to update or add new
records using DataSets and TableAdaptors?


Yes.

First create a DataSource.
- Menu->Data->Show Data Sources->Add New DataSource
- Follow wizard
- You should end with one Typed-DataSet with one or more DataTable('s) and a
TableAdapter for each DataTable.

The Typed-DataSet is shown as a Data Source inside Data Sources window.
You can simple drag a DataTable onto a Form and everything will be setup on
the Form ( DataGridView, BindingNavigator, BindingSource, TableAdapter,
DataSet). In the code view you should already see all steps required to
Fill and Update using a TableAdapter.

But you can offcourse do it entirely from code:
' Suppose you have a typed DataSet with one
' DataTable named Customers:

Dim ds As New NorthwindDataSet
Dim ta As New CustomersTableAdapter

ta.Fill( ds.Customers )
ds.Customers.AddCustomersRow( "Name0", ".... " )
ds.Customers.AddCustomersRow( "Name2", ".... " )
ds.Customers.AddCustomersRow( "Name3", ".... " )
ds.Customers(0).Name = "Name1"
ta.Update( ds.Customers )

An advantage of TableAdapter's is that they can have more then one select
query unlike DataAdapters. When you select a DataSet inside Data Sources
window and click the "show in DataSet designer" button, you can visually see
and configure all DataTable's and TableAdapter's.

TableAdapter's can also support direct update, eg:
CustomerTableAdapter.Insert( "Name4", "..." )

For more information, read:
http://www.msdn.microsoft.com/vbasic...wdtastvs05.asp

Note that you can still use the old DataAdapter/Connection objects from the
Designer, just right click the toolbox and select "Choose Items".

HTH,
Greetings


Nov 27 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.