Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problems with CommandBuilder
Message
De
27/11/2004 22:07:13
Nancy Folsom
Pixel Dust Industries
Washington, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00965146
Message ID:
00965182
Vues:
11
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform