Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
Like this article? We recommend

Building a DataSet from Scratch

The best way to learn about the DataSet is to build one from scratch instead of relying on the work performed by a .NET data provider. Listing 1 shows the code used to build up the DataSet schema programmatically and display the structure in a console window.

Listing 1—Building a DataSet

using System;
using System.Data;

namespace DisconnectedOpsDemo
{

public class BuildingDataSet
{

public static DataSet BuildDSStructure()
{
  // build the DataSet root object
  DataSet ds = new DataSet("CustOrdersDS");

  // build Customers table
  DataTable dtCusts = new DataTable("Customers");
  ds.Tables.Add(dtCusts);

  // build Orders table
  DataTable dtOrders = new DataTable("Orders");
  ds.Tables.Add(dtOrders);

  // add ID column with autoincrement numbering
  // and Unique constraint
  DataColumn dc = dtCusts.Columns.Add("ID",typeof(int));
  dc.AllowDBNull = false;
  dc.AutoIncrement = true;
  dc.AutoIncrementSeed = 1;
  dc.AutoIncrementStep = 1;
  dc.Unique = true;

  // make the ID column part of the PrimaryKey
  // for the table
  dtCusts.PrimaryKey = new DataColumn[] { dc };

  // add name and company columns with length restrictions
  // and default values
  dc = dtCusts.Columns.Add("Name",typeof(string));
  dc.MaxLength = 14;
  dc.DefaultValue = "nobody";
  dc = dtCusts.Columns.Add("Company",typeof(string));
  dc.MaxLength = 14;
  dc.DefaultValue = "nonexistent";


  // add ID columns with autoincrement numbering
  // and Unique constraint
  dc = dtOrders.Columns.Add("ID",typeof(int));
  dc.AllowDBNull = false;
  dc.AutoIncrement = true;
  dc.AutoIncrementSeed = 1;
  dc.AutoIncrementStep = 1;
  dc.Unique = true;

  // add custid, date and total columns
  dtOrders.Columns.Add("CustID",typeof(int));
  dtOrders.Columns.Add("Date",typeof(DateTime));
  dtOrders.Columns.Add("Total",typeof(Decimal));

  // add in an expression column that
  // calculates an integer value one greater than
  // the ID field
  dtOrders.Columns.Add("MyExpression",typeof(int),"ID + 1");

  // make the ID column part of the PrimaryKey
  // for the table
  dtOrders.PrimaryKey = new DataColumn[] { dc };

  // link the two tables together and autocreate
  // constraints between the two tables
  DataRelation dr = new DataRelation("CustOrderRelation",
   dtCusts.Columns["ID"],
   dtOrders.Columns["CustID"],
   true);
  ds.Relations.Add(dr);


  return ds;
}

public static void DisplayDSStructure(DataSet ds)
{
  Console.WriteLine("\nDisplaying DataSet Structure");

  // display each table
  foreach (DataTable dt in ds.Tables)
  {
   Console.WriteLine("\nTable: {0}", dt.TableName);

   Console.WriteLine("\tPrimaryKey: {0}", dt.PrimaryKey);

   // display the columns
   foreach (DataColumn dc in dt.Columns)
   {
     Console.WriteLine("\tColumn: {0}", dc.ColumnName);
     Console.WriteLine("\t\tType: {0}",
      dc.DataType.ToString());
     Console.WriteLine("\t\tUnique: {0}", dc.Unique);
     Console.WriteLine("\t\tAutoincrement: {0}",
      dc.AutoIncrement);
     Console.WriteLine("\t\tMaxLength: {0}",
      dc.MaxLength);
     Console.WriteLine("\t\tExpression: {0}",
      dc.Expression);
   }

   // display the constraints
   foreach (Constraint c in dt.Constraints)
   {
     Console.Write("\tConstraint: {0} ",
      c.ConstraintName);
     if (c is UniqueConstraint)
     {
      Console.WriteLine("UniqueConstraint");
      UniqueConstraint uc = (UniqueConstraint) c;
      Console.WriteLine("\t\t" +
        "PrimaryKey:{0}",uc.IsPrimaryKey);
     }
     else if (c is ForeignKeyConstraint)
     {
      Console.WriteLine("ForeignKeyConstraint");
      ForeignKeyConstraint fkc =
        (ForeignKeyConstraint) c;
      Console.WriteLine("\t\t Related" +
        "Table:{0}",fkc.RelatedTable);
      Console.WriteLine("\t\t Related" +
        "Column:{0}",fkc.RelatedColumns);
      Console.WriteLine("\t\t UpdateRule:{0}",
        fkc.UpdateRule);
      Console.WriteLine("\t\t DeleteRule:{0}",
        fkc.DeleteRule);
      Console.WriteLine("\t\t AcceptRejectRule:{0}",
        fkc.AcceptRejectRule);
     }
   }

   // display the relations
   foreach (DataRelation dr in dt.ParentRelations)
   {
     Console.WriteLine("\tRelation: {0}",
      dr.RelationName);
     Console.WriteLine("\t\tParent Columns: {0}",
      dr.ParentColumns);
     Console.WriteLine("\t\tParentKeyConstraint: {0}",
      dr.ParentKeyConstraint);
     Console.WriteLine("\t\tChild Columns: {0}",
      dr.ChildColumns);

     Console.WriteLine("\t\tChildKeyConstraint: {0}",
      dr.ChildKeyConstraint);
   }


  }

}


public static void Main()
{
  DataSet ds = BuildDSStructure();
  DisplayDSStructure(ds);
  Console.WriteLine();
}
}
}

The DataSet has two extremely important properties that help work with its contents: Tables holds a collection of DataTable objects that hold the data inside the DataSet; and Relations holds a collection of DataRelation objects to link tables together in a nested fashion. To start building the DataSet, we instantiate it and pass in the string value CustOrdersDS to give it a name.

The DataTable is the core feature of a DataSet with a Rows property for working with the data in a collection of DataRow objects; a Columns property that provides access to a collection of DataColumn objects used to define the schema of the table; and a Constraints property used to enforce rules and restrictions on the data entered in the form of classes such as UniqueConstraint and ForeignKeyConstraint.

The first step in building a DataTable is to instantiate it and give it a name like we did the DataSet. After that's complete, we add it to the Tables collection of the DataSet. The example does this for both the Customers and Orders tables in succession.

After the DataTable is defined and linked into the DataSet, we start adding DataColumn objects to define the schema of its data. The DataColumn type represents this key metadata and provides support for auto-increment, null, calculated, and length-restricted columns, as well as supporting most of the basic types in the .NET framework. The System.Data.SqlTypes namespace has types specific to SQL Server in case that's the data source being used; however, we don't use those in this example.

The build sample in Listing 1 adds an ID column with auto-increment value generation to both the Customers and Orders tables. Adding a column begins by using the Add method of the Columns collection that's overloaded to take the name and .NET datatype representing it in the .NET world. The auto-increment capability is added using specific properties of the DataColumn class; in this example, we start with a value of 1 as the seed and increment by one each time a new row is added to the table.

The final step in configuring the DataColumn is to create a UniqueConstraint object attached to the column. The simplest way to do so is set the Unique property of the column to true. I have also set the NULL capability to false to prevent null values.

Making the column a primary key is done outside of the DataColumn object; we have to set that as a table-level property. Notice that the table-level property PrimaryKey takes an array of DataColumn objects. This helps for those situations in which you have more than one primary key column.

The Name and Company columns are added to the Customers DataTable using a string type and are constrained using the MaxLength property. This allows the DataColumn to restrict entry of strings greater than a certain size. I have also added a DefaultValue to set the columns to "nobody" or "nonexistent" if no value is passed into them.

The Orders DataTable has Data and Total columns that are added in a simple way, but also has a strange column named MyExpression. Defining MyExpression sets the third parameter of the Add method to a value of "ID + 1". The value that comes from this column is a not stored but is computed by adding one to the primary key column of the row when the column in accessed by a DataRow object reference.

After we have created the table and column structure, we need to link the Customers and Orders tables using a DataRelation object to allow for easy navigation between parent and child rows, as well as implicitly building a ForeignKeyConstraint. The DataRelation object is instantiated on its own by name, and is passed the two column objects that identify the parent and child column. The third parameter we pass builds the necessary ForeignKeyConstraint object for us when we set it to a true value. After we have built the DataRelation, we add it to the root DataSet so it can do its magic.

Displaying the Schema

The second half of Listing 1 is the code used to display the DataSet schema structure. You can use it to troubleshoot structure creation that occurs when a DataSet is loaded by the DataAdapter or an XML document. The results are shown in Listing 2. Notice how the ForeignKeyConstraint object was created for us as part of adding the DataRelation between the two tables.

The ForeignKeyConstraint also has rules to guide modification of data: UpdateRule, DeleteRule, and AcceptRejectRule. The UpdateRule and DeleteRule can take on the following values to guide the action of a delete or update of a row that would affect the constraint:

  • Cascade deletes or updates the child rows to match the actions in a parent row.

  • SetNull sets the values of child rows to null.

  • SetDefault sets the values of child rows to a default value when the parent row has changed.

  • None means to ignore the situation and let the client handle it.

The AcceptRejectRule works in conjunction with the DataSet, DataTable, and DataRow AcceptChanges/RejectChanges methods. The AcceptChanges are a way of either accepting pending changes to data or rejecting them and rolling DataSet data back to previous values. The AcceptRejectRule determines whether to apply the action to child rows based on a call to the AcceptChanges/RejectChanges of parent rows. The default rules for a ForeignKeyConstraint are to Cascade updates/deletes while ignoring the AcceptChanges/RejectChanges propagation.

Listing 2—Output from Building a DataSet

Displaying DataSet Structure

Table: Customers
    PrimaryKey: ID
    Column: ID
        Type: System.Int32
        Unique: True
        Autoincrement: True
        MaxLength: -1
        Expression:
    Column: Name
        Type: System.String
        Unique: False
        Autoincrement: False
        MaxLength: 14
        Expression:
    Column: Company
        Type: System.String
        Unique: False
        Autoincrement: False
        MaxLength: 14
        Expression:
    Constraint: Constraint1 UniqueConstraint
         PrimaryKey:True

Table: Orders
    PrimaryKey: ID
    Column: ID
        Type: System.Int32
        Unique: True
        Autoincrement: True
        MaxLength: -1
        Expression:
    Column: CustID
        Type: System.Int32
        Unique: False
        Autoincrement: False
        MaxLength: -1
        Expression:
    Column: Date
        Type: System.DateTime
        Unique: False
        Autoincrement: False
        MaxLength: -1
        Expression:
    Column: Total
        Type: System.Decimal
        Unique: False
        Autoincrement: False
        MaxLength: -1
        Expression:
    Column: MyExpression
        Type: System.Int32
        Unique: False
        Autoincrement: False
        MaxLength: -1
        Expression: ID + 1
    Constraint: Constraint1 UniqueConstraint
         PrimaryKey:True
    Constraint: CustOrderRelation ForeignKeyConstraint
         Related Table:Customers
         Related Column:ID
         UpdateRule:Cascade
         DeleteRule:Cascade
         AcceptRejectRule:None
    Relation: CustOrderRelation
        Parent Columns: ID
        ParentKeyConstraint: Constraint1
        Child Columns: CustID
        ChildKeyConstraint: CustOrderRelation

Adding Data to the DataSet

The DataSet does no good if it consists of only structure without data. Listing 3 shows how to load row data using the DataSet structure building code from Listing 1. For those who are itching to use the database, fear not—we'll allow the DataAdapter to do the hard work in conjunction with a data source at the end of this article.

Listing 3—Filling a DataSet with Data

using System;
using System.Data;

namespace DisconnectedOpsDemo
{

public class FillingDataSet
{

public static void AddDSData(DataSet ds)
{
  DataTable dtCusts = ds.Tables["Customers"];

  // add customer by creating a DataRow from table
  // row factory method
  DataRow dr = dtCusts.NewRow();
  dr["Name"] = "Mike Smith";
  dr["Company"] = "XYZ Company";
  dtCusts.Rows.Add(dr);

  // pull back the autoincrement field so we
  // can use it as the foreign key for the orders
  int SmithCustID = (int) dr["ID"];

  // uncomment below to demonstrate
  // ConstraintException because ID column
  // violates Unique constraint
  /*
   dr = dtCusts.NewRow();
   dr["ID"] = SmithCustID;
   dr["Name"] = "Mike Smith";
   dr["Company"] = "XYZ Company";
   dtCusts.Rows.Add(dr);
  */

  dr = dtCusts.NewRow();
  dr["Name"] = "John Doe";

  // Uncomment code below to generate
  // Argument exception because of Name
  // column data size violation
  //dr["Name"] = "This is more than 24 characters";

  dr["Company"] = "ABC Corp";
  dtCusts.Rows.Add(dr);
  int DoeCustID = (int) dr["ID"];

  DataTable dtOrders = ds.Tables["Orders"];

  // add Order using factory method
  dr = dtOrders.NewRow();
  dr["CustID"] = SmithCustID;
  dr["Date"] = DateTime.Now;
  dr["Total"] = 29.99;
  dtOrders.Rows.Add(dr);

  // add Order by using an object array
  dtOrders.Rows.Add(
   new object[] {null,
   SmithCustID,DateTime.Now,99.99});

  // uncomment below to demonstrate
  // InvalidConstraintException because of bad
  // foreign key
  /*
    dtOrders.Rows.Add(
   new object[] {null,
   -1,DateTime.Now,555.55});
  */

  dtOrders.Rows.Add(
   new object[] {null,
    DoeCustID,
   DateTime.Parse("2/5/2001"), 19.99});

  dtOrders.Rows.Add(
   new object[] {null,
   DoeCustID,
   DateTime.Parse("2/15/2001"), 29.99});


}

public static void DisplayDSData(DataSet ds)
{
  Console.WriteLine("\nNavigating by DataTable");

  // display each table
  foreach (DataTable dt in ds.Tables)
  {
   Console.WriteLine("\nTable: {0}", dt.TableName);

   // go through table rows by index
   for (int rowindex = 0;
     rowindex < dt.Rows.Count; rowindex++)
   {
     DataRow dr = dt.Rows[rowindex];
     Console.Write("Row: {0} ",rowindex);

     // loop thru each column and display name/value
     foreach (DataColumn dc in dt.Columns)
     {
      Console.Write("{0}={1} ",
        dc.ColumnName, dr[dc.ColumnName]);
     }
     Console.WriteLine();
   }
  }


}

public static void NavigateDSRelationships(DataSet ds)
{
  Console.WriteLine("\nNavigating by DataRelation\n");

  // go through Customers rows using foreach
  foreach (DataRow drCusts in
   ds.Tables["Customers"].Rows)
  {
   Console.Write("Cust Row: ");

   // loop thru each column and display name/value
   foreach (DataColumn dc in
     ds.Tables["Customers"].Columns)
   {
     Console.Write("{0}={1} ",
      dc.ColumnName, drCusts[dc.ColumnName]);
   }
   Console.WriteLine();

   // navigate to child Order rows using the
   // CustOrderRelation DataRelation
   foreach (DataRow drOrders in
     drCusts.GetChildRows("CustOrderRelation"))
   {

     Console.Write("\tOrder Row: ");

     // loop thru each column and display name/value
     foreach (DataColumn dc in
      ds.Tables["Orders"].Columns)
     {
      Console.Write("{0}={1} ",
        dc.ColumnName, drOrders[dc.ColumnName]);
     }
     Console.WriteLine();
   }

  }


}

public static void Main()
{
  DataSet ds = BuildingDataSet.BuildDSStructure();
  AddDSData(ds);
  DisplayDSData(ds);
  NavigateDSRelationships(ds);
  Console.WriteLine();
}
}
}

The DataRow class takes responsibility for carrying data payload. The DataSet provides several techniques for creating the DataRow:

  • Creating the DataRow explicitly and adding it to the Rows collection

  • Using the DataTable's AddNew factory method to manufacture a DataRow

  • Using the Add method of the Rows collection of the DataTable and passing in an object array

All of these techniques are demonstrated in Listing 3.

Creating Customer rows is simpler than the Order rows in Listing 3 because of the absence of foreign key constraints at the Customer level. The example saves the autogenerated CustID values in order to link the Order rows with their parent Customer rows.

The DataRow additions are subject to the constraints and restrictions of the column definitions. The commented-out code in Listing 3 tests out the UniqueConstraint by duplicating customer ID columns in the Customer table; it verifies the ForeignKeyConstraint by using -1 in the CustID column of an order; it also tests out the MaxLength restriction of the Name column in the Customers table.

Displaying the Data

Once the data load is complete, we can display the data by navigating through the DataTable and DataRow objects. The DisplayDSData routine from Listing 3 does so by listing both tables' row data separately. The code uses an index to loop through each DataRow object by position. The example also demonstrates on how to enumerate the DataColumn collection of the DataTable so we can write out each column name and value in the DataRow data.

The second routine, NavigateDSRelationships, uses the DataRelation capability to navigate directly from rows into the Customer table down into corresponding child rows in the Orders table. The GetChildRows of the DataRow is the gateway to this functionality and requires the name or object reference to the appropriate DataRelation object. Listing 4 is the output from the process.

Listing 4—Output from Navigating the Filled DataSet

Navigating by DataTable

Table: Customers
Row: 0 ID=1 Name=Mike Smith Company=XYZ Company
Row: 1 ID=2 Name=John Doe Company=ABC Corp

Table: Orders
Row: 0 ID=1 CustID=1 Date=5/12/2002 10:08:21 PM
Total=29.99 MyExpression=2

Row: 1 ID=2 CustID=1 Date=5/12/2002 10:08:21 PM
Total=99.99 MyExpression=3

Row: 2 ID=3 CustID=2 Date=2/5/2001 12:00:00 AM
Total=19.99 MyExpression=4

Row: 3 ID=4 CustID=2 Date=2/15/2001 12:00:00 AM
Total=29.99 MyExpression=5


Navigating by DataRelation

Cust Row: ID=1 Name=Mike Smith Company=XYZ Company
    Order Row: ID=1 CustID=1
       Date=5/12/2002 10:08:21 PM Total=29.99
       MyExpression=2
    Order Row: ID=2 CustID=1 Date=5/12/2002 10:08:21 PM
       Total=99.99 MyExpression=3
Cust Row: ID=2 Name=John Doe Company=ABC Corp
    Order Row: ID=3 CustID=2 Date=2/5/2001 12:00:00 AM
       Total=19.99 MyExpression=4
    Order Row: ID=4 CustID=2 Date=2/15/2001 12:00:00 AM
       Total=29.99 MyExpression=5

Modifying the Data

Once the data has been loaded into the DataSet, the client is free to modify and update its data. The DataSet supports a rich versioning system for data that allows it to keep track of row changes, as well as keeping several versions of column data around to help when working with a data source.

The DataRow RowState property is an enumeration type named DataRowState that represents the possible states a DataRow can cycle through: Added, Deleted, Detached, Modified, Unchanged. The state is changed to Added after adding a new DataRow to the DataTable Rows collection, Deleted when you call Delete on the DataRow, Detached if you call Remove on the DataRow. Unchanged is for a DataRow that has not had column value modifications, and Modified is the state for a DataRow whose column data has changed.

The DataRow maintains several versions of its column data based on the DataRowVersion enumeration: Original, Default, Proposed, and Current. To get a specific version of a column value, it's necessary to pass a DataRowVersion enumeration as an extra parameter to the data indexer that gives you access to the column data for a row. The default use of the indexer brackets is to return the Current value, but you can use Original enumeration to get the value that was in the DataRow before modifications began. The Default enumeration is used to get at the default value defined by the DataRow column metadata. The Proposed value is only available if the DataRow is edited with a BeginEdit/EndEdit pair. The process has other byproducts as well, as it turns off constraint checking and raising of data validation expressions. To prevent a problem getting the versioning values, be sure to call the HasVersion method that returns a bool telling the client whether the value is present.

Listing 5 shows an example that continues working with our constructed DataSet and actually modifies the data. The first thing it does is find John Doe's customer record by doing a lookup of the Name column. Once positioned on the correct DataRow, it calls Delete on the DataRow. The presence of the ForeignKeyRelationship and a Cascade value for its DeleteRule means that the corresponding child Order rows are deleted as well. Listing 6 shows the results of printing out the row state and column data versions to confirm the process.

To update Mike Smith's customer record, we use the Find method of the Rows collection by passing in the PrimaryKey value, as contrasted with our previous search for John Doe. The code also uses a BeginEdit/EndEdit pair to demonstrate the generation of a Proposed version of the column data for the Customer DataRow. After the edit of the Smith record, we display the version information. The final step in the example is to show the effect of an AcceptChanges after the modifications.

Listing 5—Modifying DataSet Data

using System;
using System.Data;

namespace DisconnectedOpsDemo
{

public class UpdatingDataSet
{
public static void ModifyDSData(DataSet ds)
{
  Console.WriteLine("\nModify DataSet");

  // clear out load and previous change
  // metadata
  ds.AcceptChanges();

  // loop through rows to find John Doe
  // using the Name column
  DataRow drDoe = null;
  foreach (DataRow dr in ds.Tables["Customers"].Rows)
  {
   if ((string)dr["Name"] == "John Doe")
   {
     drDoe = dr;
   }
  }

  // delete the Doe row to demonstrate the
  // cascading delete rule that the ForeignKey
  // constraint enforces to remove all
  // child orders of the Doe customer
  drDoe.Delete();


  // find the customer row with a primary key
  // value of 1 (Should be Smith)
  DataRow drSmith = ds.Tables["Customers"].Rows.Find(1);

  // change the name

  // change the name using the BeginEdit/EndEdit pairing
  // to get a Proposed row value
  drSmith.BeginEdit();
  drSmith["Company"] = "ABC Company";
  drSmith["Name"] = "Dale Michalk";

  // show the metadata changes to the DataSet
  DisplayDSMetaData(ds);

  drSmith.EndEdit();

}

public static void DisplayDSMetaData(DataSet ds)
{
  DisplayTableMetaData(ds.Tables["Customers"]);
  DisplayTableMetaData(ds.Tables["Orders"]);
}

public static void DisplayTableMetaData(DataTable dt)
{
  Console.WriteLine("\nDisplaying MetaData for {0}\n",
   dt.TableName);

  // go through Customers rows using foreach
  for (int index = 0; index < dt.Rows.Count;
   index++)
  {
   DataRow dr = dt.Rows[index];
   Console.WriteLine("Row #{0}", index);
   DisplayRowMetaData(dr, dt);

  }
}

public static void DisplayRowMetaData(DataRow dr, DataTable dt)
{
  Console.WriteLine("RowState:{0}", dr.RowState);

  if (dr.RowState != DataRowState.Deleted)
  {

   // loop thru each column and display name/value
   foreach (DataColumn dc in dt.Columns)
   {
     object Default = null;
     if (dr.HasVersion(DataRowVersion.Default))
     {
      Default = dr[dc.ColumnName,
        DataRowVersion.Default];
     }
     else
      Default = "N/A";

     object Original = null;
     if (dr.HasVersion(DataRowVersion.Original))
     {
      Original = dr[dc.ColumnName,
        DataRowVersion.Original];
     }
     else
      Original = "N/A";

     object Proposed = null;
     if (dr.HasVersion(DataRowVersion.Proposed))
     {
      Proposed = dr[dc.ColumnName,
        DataRowVersion.Proposed];
     }
     else
      Proposed = "N/A";

     object Current = null;
     if (dr.HasVersion(DataRowVersion.Current))
     {
      Current = dr[dc.ColumnName,
        DataRowVersion.Current];
     }
     else
      Current = "N/A";

     Console.WriteLine("\tCol:{0} Default:{1} " +
      "Original:{2} Proposed:{3} Current:{4}",
      dc.ColumnName, Default, Original,
      Proposed, Current);
   }
  }
}

public static void Main()
{
  DataSet ds = BuildingDataSet.BuildDSStructure();
  FillingDataSet.AddDSData(ds);
  Console.WriteLine("\nChanges to DataSet");
  Console.WriteLine("----------------------------------------");
  ModifyDSData(ds);
  ds.AcceptChanges();
  Console.WriteLine("\nAfter AcceptChanges");
  Console.WriteLine("----------------------------------------");
  DisplayDSMetaData(ds);
  Console.WriteLine();
}
}
}

Listing 6—Output from Modifying DataSet Data

Changes to DataSet
----------------------------------------

Modify DataSet

Displaying MetaData for Customers

Row #0
RowState:Unchanged
    Col:ID Default:1 Original:1 Proposed:1 Current:1
    Col:Name Default:Dale Michalk Original:Mike Smith
         Proposed:Dale Michalk Current:Mike Smith
    Col:Company Default:ABC Company Original:XYZ Company
         Proposed:ABC Company Current:XYZ Company
Row #1
RowState:Deleted

Displaying MetaData for Orders

Row #0
RowState:Unchanged
    Col:ID Default:1 Original:1 Proposed:N/A Current:1
    Col:CustID Default:1 Original:1 Proposed:N/A Current:1
    Col:Date Default:5/12/2002 10:32:45 PM
         Original:5/12/2002 10:32:45 PM
         Proposed:N/A Current:5/12/2002 10:32:45 PM
    Col:Total Default:29.99 Original:29.99 Proposed:N/A
         Current:29.99
    Col:MyExpression Default:2 Original:2 Proposed:N/A Current:2
Row #1
RowState:Unchanged
    Col:ID Default:2 Original:2 Proposed:N/A Current:2
    Col:CustID Default:1 Original:1 Proposed:N/A Current:1
    Col:Date Default:5/12/2002 10:32:45 PM
         Original:5/12/2002 10:32:45 PM
         Proposed:N/A Current:5/12/2002 10:32:45 PM
    Col:Total Default:99.99 Original:99.99 Proposed:N/A
         Current:99.99
    Col:MyExpression Default:3 Original:3 Proposed:N/A Current:3
Row #2
RowState:Deleted
Row #3
RowState:Deleted

After AcceptChanges
----------------------------------------

Displaying MetaData for Customers

Row #0
RowState:Unchanged
    Col:ID Default:1 Original:1 Proposed:N/A Current:1
    Col:Name Default:Dale Michalk Original:Dale Michalk
         Proposed:N/A Current:Dale Michalk
    Col:Company Default:ABC Company Original:ABC Company
          Proposed:N/A Current:ABC Company

Displaying MetaData for Orders

Row #0
RowState:Unchanged
    Col:ID Default:1 Original:1 Proposed:N/A Current:1
    Col:CustID Default:1 Original:1 Proposed:N/A Current:1
    Col:Date Default:5/12/2002 10:32:45 PM
         Original:5/12/2002 10:32:45 PM
         Proposed:N/A Current:5/12/2002 10:32:45 PM
    Col:Total Default:29.99 Original:29.99 Proposed:N/A
         Current:29.99
    Col:MyExpression Default:2 Original:2 Proposed:N/A Current:2
Row #1
RowState:Unchanged
    Col:ID Default:2 Original:2 Proposed:N/A Current:2
    Col:CustID Default:1 Original:1 Proposed:N/A Current:1
    Col:Date Default:5/12/2002 10:32:45 PM
         Original:5/12/2002 10:32:45 PM
         Proposed:N/A Current:5/12/2002 10:32:45 PM
    Col:Total Default:99.99 Original:99.99 Proposed:N/A
         Current:99.99
    Col:MyExpression Default:3 Original:3 Proposed:N/A Current:3

Press any key to continue
  • + Share This
  • 🔖 Save To Your Account