Click here to Skip to main content
15,885,309 members
Articles / General Programming / Performance

Accessing Value from System.Data.DataTable : Tip

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
27 Oct 2010CPOL 4.5K   2  
int empId = dt.Columns[EMP_ID].Ordinal;...int empId = Convert.ToInt32(dRow[empId]);

Alternatives

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

Please Sign up or sign in to vote.
27 Oct 2010Andrew Rissing
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 =...
Please Sign up or sign in to vote.
23 Oct 2010TweakBird 2 alternatives  
Accessing Value from System.Data.DataTable

License

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


Written By
Web Developer
Poland Poland
Complicated

Comments and Discussions