Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting my variable to ADO data element
Message
From
03/01/2007 09:48:54
 
 
To
02/01/2007 23:29:07
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
01181662
Message ID:
01181775
Views:
8
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform