Esempio n. 1
0
    // <Snippet1>

    public static void DemonstrateOnRemoveTable()
    {
        DerivedDataSet dataSet = CreateDataSet();

        if (dataSet.Tables.Count > 0)
        {
            dataSet.Tables.RemoveAt(0);
        }
    }
Esempio n. 2
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();
    }
Esempio n. 3
0
    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);
    }