asp.net.ph

DataSet Constructor

System.Data Namespace   DataSet Class


Initializes a new instance of the DataSet class.

Overload List

1. Initializes a new instance of the DataSet class.

2. Initializes a new instance of a DataSet class with the given name.

3. Initializes a new instance of the DataSet class with the SerializationInfo and the StreamingContext.

NOTE: This member is used internally by the .NET infrastructure and is not intended to be called directly from your code.


Example

The following example initializes a new DataSet, to which two DataTable objects are added.

NOTE: This example uses one of the overloaded versions of the DataSet constructor. For other examples that may be available, see the individual overload topics.

Private Sub CreateDataSet ( )
   Dim  myDataSet As DataSet
   myDataSet = New DataSet ( )
   ' create two DataTable objects using a function.
   Dim table1 As DataTable = MakeTable ( "idTable1", "thing1" )
   Dim table2 As DataTable = MakeTable ( "idTable2", "thing2" )
   myDataSet.Tables.Add ( table1 )
   myDataSet.Tables.Add ( table2 )
   Response.Write ( myDataSet.DataSetName, _
      myDataSet.Tables.Count )
End Sub

Private Function MakeTable ( c1Name As String, _
      c2Name As String ) As DataTable
   Dim myTable As New DataTable
   Dim myColumn As DataColumn
   ' add two DataColumns
   myColumn = New DataColumn ( c1Name, _
      System.Type.GetType ( "System.Integer" ) )
   myTable.Columns.Add ( myColumn )
   myColumn = New DataColumn ( c2Name, _
      System.Type.GetType ( "System.String" ) )
   MakeTable = myTable
End Function
See Also

DataSet Members 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