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()
{
DataTable dt = DataAccess.GetTableData();
DataColumn dcEmpId = dt.Columns[EMP_ID];
foreach (DataRow dRow in dt.Rows)
{
int empId = Convert.ToInt32(dRow[dcEmpId]);
}
}
}
Accessing data from a DataTable is actually fastest when using the DataColumn.