NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DataColumn Constructor (String, Type)

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

[Visual Basic]
Overloads Public Sub New( _
   ByVal columnName As String, _
   ByVal dataType As Type _
)
[C#]
public DataColumn(
   string columnName,
   Type dataType
);
[C++]
public: DataColumn(
   String* columnName,
   Type* dataType
);
[JScript]
public function DataColumn(
   columnName : String,
   dataType : Type
);

Parameters

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

Exceptions

Exception Type Condition
ArgumentNull(System.String) The dataType is null.

Example [Visual Basic]

The following example creates a new DataColumn with a specified ColumnName and DataType.

[Visual Basic]

Private Sub AddDataColumn()
   Dim myColumn As DataColumn 
   Dim dt As System.Type
   dt = New System.Type.GetType("System.Int32")
   myColumn = New DataColumn("id", dt)
   ' Set various properties.
   With myColumn
      .Unique = True
      .AutoIncrement = True
      .AutoIncrementSeed = 1
      .AutoIncrementStep = 1
      .ReadOnly = True
    End With
   ' Add to Columns collection.
   myTable.Columns.Add myColumn
End Sub

See Also

DataColumn Class | DataColumn Members | System.Data Namespace | DataColumn Constructor Overload List | DefaultValue | ColumnName | Caption | DataTable | DataType