asp.net.ph

DataColumn Constructor ( String )

System.Data Namespace   DataColumn Class


Inititalizes a new instance of the DataColumn class using the specified column name.

[ VB ]
Overloads Public Sub New ( _
   ByVal columnName As String _
)

[ C# ]
public DataColumn (
   string columnName
);

[ C++ ]
public: DataColumn (
   String* columnName
);

[ JScript ]
public function DataColumn (
   columnName : String
);

Parameters

columnName
A string that represents the name of the column to be created. If set to a null reference or an empty string ( "" ), a default name will be given when added to the columns collection.

Remarks

By default, the name given to a column becomes the Caption property value.

Example

The following example initializes a new DataColumn with a specified ColumnName.

private void AddDataColumn ( ) {
   DataColumn myColumn = new DataColumn ( "id" );
   // set various properties.

   myColumn.DataType = System.Type.GetType ( "System.Int32" );
   myColumn.Unique = true;
   myColumn.AutoIncrement = true;
   myColumn.AutoIncrementSeed = 1;
   myColumn.AutoIncrementStep = 1;
   myColumn.ReadOnly = true;

   // add to Columns collection.
   myTable.Columns.Add ( myColumn );
}
  C# VB

See Also

DataColumn Members   DataColumn Constructor Overload List   ColumnName   Caption   DefaultValue   DataTable   DataType Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph