System.Data Namespace DataColumnCollection Class
Initializes and adds a specified DataColumn object to the columns collection.
[ VB ] Overloads Public Sub Add ( _ ByVal column As DataColumn _ ) [ C# ] public void Add ( DataColumn column ); [ C++ ] public: void Add ( DataColumn* column ); [ JScript ] public function Add ( column : DataColumn );
If the collection is successfully changed by adding or removing columns, the CollectionChanged event occurs.
The following example initializes and adds a new DataColumn to the DataColumnCollection of a DataTable using this constructor.
Private Sub AddColumn ( ) ' get the DataColumnCollection from a table in a DataSet. Dim cols As DataColumnCollection = ds.Tables ( "Prices" ).Columns Dim myCol As New DataColumn ( ) With myCol .ColumnName = "Total" .DataType = System.Type.GetType ( "System.Decimal" ) .Expression = "UnitPrice * Quantity" .ReadOnly = True .Unique = False End With cols.Add ( myCol ) End Sub
DataColumnCollection Members DataColumnCollection.Add Overload List DataColumn
© 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