Click here to Skip to main content
13,092,310 members (58,721 online)
Click here to Skip to main content
Add your own
alternative version


2 bookmarked
Posted 26 Oct 2010

Accessing Value from System.Data.DataTable : Tip

, 27 Oct 2010
Technically, the best approach here for speed and flexibility is to do the following:public class TestClass{ private const string EMP_ID = "EmpId"; public void MyTestMethod() { //GetData fetches data from the database using a SQL query DataTable dt =...


Members may post updates or alternatives to this current article in order to show different approaches or add new features.

23 Oct 2010
2 alternatives  
Accessing Value from System.Data.DataTable
27 Oct 2010
int empId = dt.Columns[EMP_ID].Ordinal; empId = Convert.ToInt32(dRow[empId]);


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Andrew Rissing
Software Developer (Senior)
United States United States
Since I've begun my profession as a software developer, I've learned one important fact - change is inevitable. Requirements change, code changes, and life changes.

So..If you're not moving forward, you're moving backwards.

| | Privacy | Terms of Use | Mobile
Web04 | 2.8.170813.1 | Last Updated 27 Oct 2010
Article Copyright 2010 by Andrew Rissing
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid