April 30, 2011

Create DataTable in ASP.Net

DataTable dtEMP = new DataTable("EMP");

DataColumn dcEID = new DataColumn("EID");
dtEMP.Columns.Add(dcEID);

DataColumn dcNAME = new DataColumn("NAME");
dtEMP.Columns.Add(dcNAME);

DataRow drEMP;

drEMP = dtEMP.NewRow();

drEMP[0] = "1001";
drEMP[1] = "Shatrughna Kumar";

dtEMP.Rows.Add(drEMP);

No comments:

Post a Comment