?
Solved

Question about working with single row in datatable?

Posted on 2007-03-26
1
Medium Priority
?
220 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 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

800 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