Link to home
Start Free TrialLog in
Avatar of astensland
astensland

asked on

How to retrieve a given value from a table in a dataset

I was just wondering how you retrieve a given value from a table in a dataset. I am not interested in looping through, I know which column and row the value is in.... In VB.NET I could type like this:

ds.Tables("tblGame").Rows(0).Item("result")

This does not work in C#, since I can find no Item method... How do I retrieve this value in a simple manner???

regards, Anders
ASKER CERTIFIED SOLUTION
Avatar of johan_asplund
johan_asplund

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jlach
jlach

Also... ds.Tables["tblGame"].Rows[0].Columns["result"].ToString();


I suggest downloading this white paper (approximately 12 to 15 pages)

http://support.microsoft.com/?kbid=308470


It explicitly states the differences between VB and C#.  You could have saved yourself a few points.

cheers
Avatar of astensland

ASKER

Thanx Johan, that worked great. The other tip, with the rows[0].Columns["result"] does not work. Or not according to my intellisense... When I press the . after Rows[0] Columns is not an option. But the tip Johan gave worked!! Thanx alot. And also, thanx for the whitepaper. That was quite interesting.

Cheers