Friday, January 8, 2010

How to create a column in the DataTable

To create a column in the DataTable we can use the Columns.Add method of the DataTable object and pass DataColumn object as parameter.


DataTable dTable = new DataTable();

// create another column

DataColumn name = new DataColumn("Name", typeof(string));

dTable.Columns.Add(name);

No comments:

Post a Comment