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, String, Boolean)

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( _
   ByVal columnName As String, _
   ByVal dataType As Type, _
   ByVal expr As String, _
   ByVal isAttribute As Boolean _
)
[C#]
public DataColumn(
   string columnName,
   Type dataType,
   string expr,
   bool isAttribute
);
[C++]
public: DataColumn(
   String* columnName,
   Type* dataType,
   String* expr,
   bool isAttribute
);
[JScript]
public function DataColumn(
   columnName : String,
   dataType : Type,
   expr : String,
   isAttribute : Boolean
);

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.
expr
The expression used to create this column. For more details, see the Expression property.
isAttribute
[To be supplied.]

Example [Visual Basic]

The following example constructs a computed column.

[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 | DataColumn Constructor Overload List | ColumnName | Caption | DefaultValue | DataTable | DataType