Solved

Question about working with single row in datatable?

Posted on 2007-03-26
1
216 Views
Last Modified: 2010-04-16
What is the appropriate way to read data from a single row in a datatable.

I have a dataset table adapter that returns a single row.

In a situation where I needed to work through multiple rows I would do a

foreach (DataRow r1 in areaDT)

Is that the correct way to pull data from a single row or is there a more efficeint way to do it when you know its only a si ngle row returned?
0
Comment
Question by:Prysson
[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
1 Comment
 
LVL 7

Accepted Solution

by:
badbearontour earned 500 total points
ID: 18793439
Hi,

I would just use a similar setting to below, if you can guarantee that the dataAdapter will only ever return one row.


datarow myOneRow = datatableAdapterGetMyOneRow();  //assuming the method only returns a dataRow and not a dataRow[]!!

string example = myOneRow["NameForInstance"].toString();

I dont know of any other way you could deal with a dataRow

BB
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C# Gridview 1 66
C# MVC Insert Multiple Row into DB 2 65
Input parameteres to DragOver 2 38
ASP.NET MVC -Update model when click on <li> element 29 70
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

730 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