// <Snippet1> public static void DemonstrateOnRemoveTable() { DerivedDataSet dataSet = CreateDataSet(); if (dataSet.Tables.Count > 0) { dataSet.Tables.RemoveAt(0); } }
// <Snippet1> private void RejectChangesInDataSet() { // Instantiate the derived DataSet. DerivedDataSet derivedData = new DerivedDataSet(); // Insert code to change values. // Invoke the RejectChanges method in the derived class. derivedData.RejectDataSetChanges(); }
public static DerivedDataSet CreateDataSet() { // Create a DataSet with one table containing two columns. DerivedDataSet derived = new DerivedDataSet(); // Add table to DataSet. DataTable table = derived.Tables.Add("Items"); // Add two columns. DataColumn column = table.Columns.Add("id", typeof(int)); column.AutoIncrement = true; table.Columns.Add("item", typeof(int)); // Set primary key. table.PrimaryKey = new DataColumn[] { table.Columns["id"] }; return(derived); }