Error
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.

datacolumn

Make datacolumn as readonly
Wednesday, 01 February 2012 01:22
Following code make accountnumber column as readonly that does not allows for changes as soon as a row has been added to the table.


DataColumn col= new DataColumn();
col.ColumnName = "AccountNumber";
col.Readonly= true;
// Add the column to the datatable
mydatatable.Columns.Add(col);

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/QsQhBloZ4KM/14605

 
Sets the maximum length of a text column in datatable.
Wednesday, 01 February 2012 01:20
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

 
Change/Set the name of the column in the DataColumnCollection.
Wednesday, 01 February 2012 01:17
Change/Set the name of the column in the DataColumnCollection.

DataColumn col= new DataColumn();
col.ColumnName = "SupplierID";
col.AutoIncrement = false;
// Add the column to the datatable
mydatatable.Columns.Add(col);

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/XN-bp3kxZwY/14601

 
Create a datacolumn which automatically increments the value of the column for new rows added to the table
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: http://feeds.dzone.com/~r/dzone/snippets/~3/aGvq9wdqBdw/14593

 


Taxonomy by Zaragoza Online