Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting my variable to ADO data element
Message
From
16/01/2007 00:46:37
 
 
To
15/01/2007 23:51:58
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
01181662
Message ID:
01185806
Views:
12
Sam,

If the TableName of the first DataTable in the Tables collection of the DataSet is "MyTable", then there isn't any difference between
....Table[0]
and
...Table["MyTable"]
However, if you have more than one DataTable, then using the ...Table["MyTable"] syntax might be preferable, since then you don't have to remember which table number it is (i.e. the index into the Tables collection) ... for example, if "MyTable" was the TableName of the 3rd DataTable in the DataSet, then you'd use ...Table[2] to access it by index.

~~Bonnie



>>
>>string MyVariable = MyDataSet.Tables[0].Rows[0]["MyColumn"].ToString();
>>
>>or
>>
>>string MyVariable = MyDataSet.Tables["MyTable"].Rows[0]["MyColumn"].ToString();
>>
>
>
>Hi Bonnie.
>In your code above what is the difference between
>
....Table[0]
> and
>
...Table["myTable"]
?
>
>Thanks.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform