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

Initializes a new instance of the DataColumn class.

Overload List

Initializes a new instance of a DataColumn class.

[Visual Basic] Overloads Public Sub New()
[C#] public DataColumn();
[C++] public: DataColumn();
[JScript] public function DataColumn();

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

[Visual Basic] Overloads Public Sub New(String)
[C#] public DataColumn(String);
[C++] public: DataColumn(String*);
[JScript] public function DataColumn(String);

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

[Visual Basic] Overloads Public Sub New(String, Type)
[C#] public DataColumn(String, Type);
[C++] public: DataColumn(String*, Type);
[JScript] public function DataColumn(String, Type);

Initializes a new instance of the DataColumn class using the specified name, data type, and expression.

[Visual Basic] Overloads Public Sub New(String, Type, String)
[C#] public DataColumn(String, Type, String);
[C++] public: DataColumn(String*, Type, String*);
[JScript] public function DataColumn(String, Type, String);

Initializes a new instance of the DataColumn class using the specified name, data type, expression, and value that determines whether the column is an attribute.

[Visual Basic] Overloads Public Sub New(String, Type, String, Boolean)
[C#] public DataColumn(String, Type, String, bool);
[C++] public: DataColumn(String*, Type, String*, bool);
[JScript] public function DataColumn(String, Type, String, Boolean);

Example [Visual Basic]

The following example constructs a computed column.

Note   This example shows how to use one of the overloaded version of the DataColumn constructor. For other examples that may be available, see the individual overload topics.

[Visual Basic]

Private Sub CreateComputedColumn()
   Dim myColumn As DataColumn
   Dim dt As System.Type
   Dim strExpr As String
   dt = System.Type.GetType("System.Currency")
   strExpr = "Price * Quantity"
   myColumn = New DataColumn("Total", dt, strExpr, False)
   ' Add the column to a DataTable object's ColumnsCollection
   Dim myTable As DataTable
   myTable = DataSet1.Tables("OrderDetails").Columns.Add(myColumn)

End Sub

See Also

DataColumn Class | DataColumn Members | System.Data Namespace