Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems with CommandBuilder
Message
From
27/11/2004 22:07:13
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00965146
Message ID:
00965182
Views:
12
Hi, Gerard-

>When I use the oAD.Update (Adapter command update) i get the folowing:
> The Data Adapter.Select command parameter needs to be initialised.
>
>I added in a :
>oAD.SelectCommand = "Select * from mytable" but I get an error saying canot assign a string to an adapater....

Just to add an explicit explanation for this, the SelectCommand property takes a Command _object_, not a string. The Command object then has a string property called SelectText. You don't pass the Select text and connection to the OleDbDataAdapter's constructor, but to the Command object's constructor. For example:
string selectText = "SELECT "+this.sFields+" FROM "+this.sTableName
DataAdapter dataAdapter = new DataAdapter();
dataAdapter.SelectCommand = new OleDbCommand(selectText, oCon);
The DataAdapter has several associated command members: select, update, and insert.

HTH
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform