How to generate dynamic Data Tabel ?

Posted by Ranjeet_8 under ASP.NET category on | Points: 40 | Views : 910
        DataTable dt = new DataTable();
dt.Columns.Add("EmpCode", typeof(int));
dt.Columns.Add("EmpName", typeof(string));
dt.Columns.Add("InsertedDate", typeof(DateTime));

// Here we add 5 DataRows.
dt.Rows.Add(1001, "AAA", DateTime.Now);
dt.Rows.Add(1002, "BBB", DateTime.Now);
dt.Rows.Add(1003, "CCC", DateTime.Now);
dt.Rows.Add(1004, "DDD", DateTime.Now);
dt.Rows.Add(1005, "EEE", DateTime.Now);

Comments or Responses

Login to post response