DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Sets The Maximum Length Of A Text Column In Datatable.

02.01.2012
| 4015 views |
  • submit to reddit
        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);