|
Wednesday, 01 February 2012 01:13 |
Change the caption for the column. Add following code to change caption of the datatable column
DataColumn col;
mytable.Columns.Add("StudentName", System.Type.GetType("System.String"));
col.Caption = "Name";
 Read more: |
|
Tuesday, 31 January 2012 09:57 |
following code will add a datacolumn which automatically increments the value of the column for new rows added to the table
DataColumn newcolumn=new DataColumn("studentID", System.Type.GetType("System.Int32"));
newcolumn.AutoIncrement = true;
newcolumn.AutoIncrementSeed = 1;
newcolumn.AutoIncrementStep = 1;
//// Add column to datatable.
DataTable mytable=new DataTable();
mytable.Columns.Add(column);
 Read more: |