This documentation is archived and is not being maintained.
DataSet Constructor
.NET Framework 1.1
Initializes a new instance of the DataSet class.
Overload List
Initializes a new instance of the DataSet class.
Supported by the .NET Compact Framework.
[Visual Basic] Public Sub New()
[C#] public DataSet();
[C++] public: DataSet();
[JScript] public function DataSet();
Initializes a new instance of a DataSet class with the given name.
Supported by the .NET Compact Framework.
[Visual Basic] Public Sub New(String)
[C#] public DataSet(string);
[C++] public: DataSet(String*);
[JScript] public function DataSet(String);
This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
[Visual Basic] Protected Sub New(SerializationInfo, StreamingContext)
[C#] protected DataSet(SerializationInfo, StreamingContext);
[C++] protected: DataSet(SerializationInfo*, StreamingContext);
[JScript] protected function DataSet(SerializationInfo, StreamingContext);
Example
[Visual Basic] The following example creates a new DataSet, to which two DataTable objects are added.
[Visual Basic] Note This example shows how to use one of the overloaded versions of the DataSet constructor. For other examples that might be available, see the individual overload topics.
[Visual Basic]
Private Sub CreateDataSet()
Dim myDataSet As DataSet
myDataSet = New DataSet("aNewDataSet")
' 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)
Console.WriteLine(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
[C#, C++, JScript] No example is available for C#, C++, or JScript. To view a Visual Basic example, click the Language Filter button
in the upper-left corner of the page.
See Also
Show: