Sets the maximum length of a text column in datatable.


DataColumn col= new DataColumn();
col.ColumnName = "StudentId";
col.MaxLength = 255;
// Add the column to the datatable
mydatatable.Columns.Add(col);

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/uIhVU793dkY/14603