Solved

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

Posted on 2003-10-22
4
216 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 50 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

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 aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

831 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