System.Data Namespace DataSet Class
Initializes a new instance of the DataSet class.
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.
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
DataSet Members