Hello,
Suppose following is your DataTable which return Stored Procedure..
DataTable dtExample = new DataTable("Example");
dtExample.Columns.Add("EmpID");
dtExample.Columns.Add("Name");
If You have following Class like
public class Employees
{
public String EmpID { get ; set ;}
public String Name{ get ; set ;}
}
Create function that will be return Employee Class from DataRow
private Employees GetEmpDataTableRow(DataRow dr)
{
Employees oEmp = new Employees();
oEmp.EmpID = dr["EmpID"].ToString();
oEmp.Name = dr["Name"].ToString();
return oEmp ;
}
Finnally call it using Loop like
List<employees> objEmpList=new List<employees>();
foreach (DataRow row in dtExample.Rows)
objEmpList.Add(row);
</employees></employees>