Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Setting my variable to ADO data element
Message
De
03/01/2007 09:48:54
 
 
À
02/01/2007 23:29:07
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
01181662
Message ID:
01181775
Vues:
9
Hi Sam,

Both Michel and Mike showed you VB syntax. The way to access DataSet information has a slightly different syntax in C#.
string MyVariable = MyDataSet.Tables[0].Rows[0]["MyColumn"].ToString();
or
string MyVariable = MyDataSet.Tables["MyTable"].Rows[0]["MyColumn"].ToString();
As Mike also mentioned, the use of a strongly typed DataSet will help ... you get Intellisense and the syntax is far more readable:
string MyVariable = MyDataSet.MyTable[0].MyColumn;
You can generate Typed DataSets in the IDE by using an .xsd for your DataSets.

~~Bonnie



>Hello.
>
>I've been trying to set a variable to a data brought back from a foxpro table.
>
>In VFP it would look something like this:
>
>lcMyVariable = ALLTRIM(customer.firstname)
>
>
>What would be C# version of this statement?
>
>TIA
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform