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

Stats

8.6K views
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 =...

Alternatives

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

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

License

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

Share

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