Solved

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

Posted on 2003-10-22
4
211 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
Comment Utility
Hello

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

br
Johan

0
 
LVL 1

Expert Comment

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

Expert Comment

by:_TAD_
Comment Utility


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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

728 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now