Initializes a new instance of the DataSet class.
Initializes a new instance of the DataSet class.
[Visual Basic] Overloads 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.
[Visual Basic] Overloads Public Sub New(String)
[C#] public DataSet(String);
[C++] public: DataSet(String*);
[JScript] public function DataSet(String);
The following example creates a new DataSet, to which is added two DataTable objects.
Note This example shows how to use one of the overloaded version of the DataSet constructor. For other examples that may be available, see the individual overload topics.
[Visual Basic]
Private Sub CreateDataSet() Dim ds As DataSet ds = New DataSet("aNewDataSet") ' Create two DataTable objects using a function. Dim t1 As DataTable = MakeTable("idTable1", "thing1") Dim t2 As DataTable = MakeTable("idTable2", "thing2") ds.Tables.Add(t1) ds.Tables.Add(t2) Console.WriteLine(ds.DataSetName, ds.Tables.Count) End Sub Private Function MakeTable(c1Name As String, c2Name As String) As DataTable Dim t As New DataTable Dim col As DataColumn ' Add two DataColumns col = New DataColumn(c1Name, System.Type.GetType("System.Integer")) t.Columns.Add col col = New DataCOlumn(c2Name, System.Type.GetType("System.String")) MakeTable = t End Function