Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2003-10-22
4
Medium Priority
?
229 Views
Last Modified: 2010-04-16
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
0
Comment
Question by:astensland
4 Comments
 
LVL 1

Accepted Solution

by:
johan_asplund earned 200 total points
ID: 9597326
Hello

Try this
ds.Tables["tblGame"].Rows[0]["result"]

br
Johan

0
 
LVL 1

Expert Comment

by:jlach
ID: 9599670
Also... ds.Tables["tblGame"].Rows[0].Columns["result"].ToString();
0
 
LVL 22

Expert Comment

by:_TAD_
ID: 9602602


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
0
 

Author Comment

by:astensland
ID: 9604721
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
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question