Solved

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

Posted on 2003-10-22
4
227 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

622 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