[Mono-list] Patch for System.Data.Common.DbDataProvider.cs

Sergei Malinin smalinin@amurnet.ru
Tue, 23 Dec 2003 19:23:12 +1000


This is a multi-part message in MIME format.
--------------000303080806060007060002
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hi All,

I have created the patch for System.Data.Common.DbDataProvider.cs,
based on my problems with Mono implementation.

I found the next problems, when I testing our ADO.NET providers under
the Mono enviroment.

1) 'DbDataProvider' implementaion doesn't properly handle the
'MissingSchemaAction' property, when MissingSchemaAction == 
MissingSchemaAction.AddWithKey
  When I call the DbDataAdapter.Fill(DataSet, string); method, it doesn't properly
  add the primary key information.
  Sample: DataAdapterUpdate1.cs

2) 'DbDataProvider' implementaion doesn't properly handle the 
DbDataAdapter.Update(DataSet, string);
This method doesn't properly call DataRow.AcceptChanges(), when CommandBuilder 
is used.
  Sample: CmdBuilder1.cs

3) The method DbDataProvider.FillSchema(DataSet, SchemaType.Source, string);
doesn't properly fill information about the primary keys.
   Sample: DbDataAdapterFillSchema1.cs

All samples works without any problem under the MS.NET Framework.
For recreating of my samples, you can use the our OpenLink ADO.NET provider
for MS SQL Server:
provider =>  http://download.openlinksw.com/uda/open51/ntl5nsql.zip
documentation=> http://download.openlinksw.com/uda/open51/opldocu_lt.taz

The sql script for table creation:
  create_table.sql

Samples:
   DataAdapterUpdate1.cs
   CmdBuilder1.cs
   DbDataAdapterFillSchema1.cs

Build script:
   build.bat

All problems, that were described above, were fixed.
The patch is attached also.
patch =>  System.Data.Common.DbDataProvider.diff


-- 
Best Regards,
Sergei Malinin
UDA Product Development
OpenLink Software
Email: 	smalinin@openlinksw.com   smalinin@amurnet.ru
Web: http://www.openlinksw.com
Universal Data Access & Data Integration Technology Providers

--------------000303080806060007060002
Content-Type: text/plain;
 name="System.Data.Common.DbDataAdapter.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="System.Data.Common.DbDataAdapter.diff"

? System.Data.Common.DbDataAdapter.diff
Index: DbDataAdapter.cs
===================================================================
RCS file: /mono/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs,v
retrieving revision 1.35
diff -u -r1.35 DbDataAdapter.cs
--- DbDataAdapter.cs	17 Dec 2003 01:59:11 -0000	1.35
+++ DbDataAdapter.cs	23 Dec 2003 09:44:40 -0000
@@ -362,6 +362,8 @@
 		
 		protected virtual int Fill (DataSet dataSet, int startRecord, int maxRecords, string srcTable, IDbCommand command, CommandBehavior behavior) 
 		{
+			if (MissingSchemaAction == MissingSchemaAction.AddWithKey)
+			    behavior |= CommandBehavior.KeyInfo;
 			CommandBehavior commandBehavior = behavior;
 			if (command.Connection.State == ConnectionState.Closed) {
 				command.Connection.Open ();
@@ -516,8 +518,7 @@
 				// generate DataSetColumnName from DataTableMapping, if any
 				string dsColumnName = realSourceColumnName;
 				DataTableMapping tableMapping = null;
-				if (schemaType == SchemaType.Mapped)
-					tableMapping = DataTableMappingCollection.GetTableMappingBySchemaAction (TableMappings, table.TableName, table.TableName, MissingMappingAction); 
+				tableMapping = DataTableMappingCollection.GetTableMappingBySchemaAction (TableMappings, table.TableName, table.TableName, MissingMappingAction); 
 				if (tableMapping != null) 
 				{
 					
@@ -552,7 +553,7 @@
 				}
 				readerIndex++;
 			}
-			if (MissingSchemaAction == MissingSchemaAction.AddWithKey && primaryKey.Count > 0)
+			if (primaryKey.Count > 0)
 				table.PrimaryKey = (DataColumn[])(primaryKey.ToArray(typeof (DataColumn)));
 
 			return mapping;
@@ -697,7 +698,6 @@
 
 						parameter.Value = row [dsColumnName, rowVersion];
 					}
-					row.AcceptChanges ();
 				}
 
 				if (command.Connection.State == ConnectionState.Closed) 
@@ -711,6 +711,7 @@
 						throw new DBConcurrencyException("Concurrency violation: the " + commandName +"Command affected 0 records.");
 					updateCount += tmp;
 					OnRowUpdated (CreateRowUpdatedEvent (row, command, statementType, tableMapping));
+					row.AcceptChanges ();
 				}
 				catch (Exception e)
 				{

--------------000303080806060007060002
Content-Type: text/plain;
 name="CmdBuilder1.cs"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="CmdBuilder1.cs"

namespace Tests
{

using System;
using System.Data;
using System.Data.Common;
using System.Diagnostics;
using SQLServer = OpenLink.Data.SQLServer;

public class CmdBuilder1
{
  static string connStr = "SVT=SQLServer2000;DATABASE=pubs;UID=sa;Server=pcwin;PWD=;";

  public static void Main()
  {
    CmdBuilder1 myCmdBuilder1 = new CmdBuilder1();
    myCmdBuilder1.Run();
  }

  public void Run()
  {
      IDbConnection myConnection;
      DbDataAdapter myOPLDataAdapter;
      DbDataAdapter myOPLDataAdapter1;
      System.ComponentModel.Component myCommandBuilder; 

      myConnection = new SQLServer.OPLConnection (connStr);
      myOPLDataAdapter = new SQLServer.OPLDataAdapter 
            ("select * from UCSCustomers", (SQLServer.OPLConnection) myConnection);
      myOPLDataAdapter1 = new SQLServer.OPLDataAdapter
            ("select * from UCSOrders", (SQLServer.OPLConnection) myConnection);

      // Create command builder. 
      // This line automatically generates the update commands for you, so you
      // don't have to provide or create your own.
      myCommandBuilder 
	    = new SQLServer.OPLCommandBuilder ((SQLServer.OPLDataAdapter)myOPLDataAdapter);

    // Restore database to it's original condition so test app will work 
    // correctly.
    Cleanup();

    try
    {
      DataSet myDataSet = new DataSet();
      DataRow myDataRow;

      // Set the MissingSchemaAction property to AddWithKey because Fill 
      // will not cause primary key & unique key information to be retrieved
      // unless AddWithKey is specified.
      myOPLDataAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
      myOPLDataAdapter1.MissingSchemaAction = MissingSchemaAction.AddWithKey;

      myOPLDataAdapter.Fill(myDataSet,"Customers");
      Console.WriteLine("Loaded data from Customers table into dataset.");

      myOPLDataAdapter1.Fill(myDataSet,"Orders");
      Console.WriteLine("Loaded data from Orders table into dataset.");

      // Add relation
      myDataSet.Relations.Add("CustOrders",
      myDataSet.Tables["Customers"].Columns["CustomerID"],
      myDataSet.Tables["Orders"].Columns["CustomerID"]);


      // Edit row value
      myDataSet.Tables["Customers"].Rows[0]["ContactName"]="Peach";

      // Add row
      myDataRow = myDataSet.Tables["Customers"].NewRow();
      myDataRow["CustomerID"] ="NewID";
      myDataRow["ContactName"] = "New Name";
      myDataRow["CompanyName"] = "New Company Name";
      myDataSet.Tables["Customers"].Rows.Add(myDataRow);
      Console.WriteLine(
	  	  "Inserted new row (CustomerID='NewID') into " + 
		  "Dataset table 'Customers'.");

      // Add row
      myDataRow = myDataSet.Tables["Customers"].NewRow();
      myDataRow["CustomerID"] ="NUID2";
      myDataRow["ContactName"] = "New Name2";
      myDataRow["CompanyName"] = "New Company Name2";
      myDataSet.Tables["Customers"].Rows.Add(myDataRow);
      Console.WriteLine(
	  	  "Inserted new row (CustomerID='NUID2') into " + 
		  "Dataset table 'Customers'.");


      // Update database with OPLDataAdapter
      myOPLDataAdapter.Update(myDataSet, "Customers");
      Console.WriteLine("Propagated DataAdapter changes to database.");

      // Delete row
      DataRow[] myDataRows = 
	      myDataSet.Tables["Customers"].Select("CustomerID='NUID2'");
	  myDataRows[0].Delete();
      Console.WriteLine(
	  	  "Deleted row (CustomerID='NUID2') from " + 
		  "Dataset table 'Customers'.");

      // Propagate row deletion to database with OPLDataAdapter
      myOPLDataAdapter.Update(myDataSet, "Customers");
      Console.WriteLine("Propagated DataAdapter deletion to database.");

      Console.WriteLine("DataSet processing has completed successfully!");
    }
    catch(Exception e)
    {
      Console.WriteLine(e.ToString());
    }
  }

  public void Cleanup()
  {
    IDbConnection myConnection;

    myConnection = new SQLServer.OPLConnection (connStr);

    try
    {
      myConnection.Open();
      IDbCommand CleanupCommand = myConnection.CreateCommand ();
      CleanupCommand.CommandText = 
	  "DELETE FROM UCSCustomers WHERE CustomerID = 'NewID'";
      CleanupCommand.ExecuteNonQuery();
    }
    catch (Exception e)
    {
      Console.WriteLine(e.ToString());
    }
    finally
    {
      myConnection.Close();
    }
  }
}

}

--------------000303080806060007060002
Content-Type: text/plain;
 name="DataAdapterFillSchema1.cs"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="DataAdapterFillSchema1.cs"

namespace Tests
{

using System;
using System.Data;
using System.Data.Common;
using SQLServer = OpenLink.Data.SQLServer;

public class DataAdapterFillSchema1
{
  static string connStr = "SVT=SQLServer2000;DATABASE=pubs;UID=sa;Server=pcwin;PWD=;";

  public static void Main ()
  {
    DataAdapterFillSchema1 myDataAdapter = new DataAdapterFillSchema1 ();
    myDataAdapter.Run ();
  }

  public void Run ()
  {
    IDbConnection m_connection;

    m_connection = new SQLServer.OPLConnection (connStr);

    IDbCommand selectCmd = m_connection.CreateCommand ();
    selectCmd.CommandText = "SELECT CustomerID, CompanyName FROM UCSCustomers";
    selectCmd.CommandTimeout = 30;

    DbDataAdapter custDA;

    custDA = new SQLServer.OPLDataAdapter ((SQLServer.OPLCommand) selectCmd);

    DataSet custDS = new DataSet();

    // The Fill method does not add schema information to the DataSet by default. 
    // To populate a DataSet with existing primary key constraint information from
    // a data source, you can either call the FillSchema method of the DataAdapter, 
    // or set the MissingSchemaAction property of the DataAdapter to AddWithKey 
    // before calling Fill.

    // SchemaType.Source => Ignore any table mappings on the DataAdapter. 
    // Configure the DataSet using the incoming schema without applying 
    // any transformations

    // The FillSchema method retrieves the schema from the data source using the 
    // SelectCommand. It adds a DataTable to the destination DataSet, adds columns 
    // to the DataColumnCollection of the DataTable, and configures the following DataColumn 
    // properties:
    //	 AllowDBNull, MaxLength, ReadOnly, Unique.
    //   FillSchema also configures the PrimaryKey and Constraints properties.

    DataTable[] rDataTbl;

    rDataTbl = custDA.FillSchema (custDS, SchemaType.Source, "Customers");

    foreach (DataTable dt in rDataTbl)
    {
	Console.WriteLine ("Table name: {0}", dt.TableName);

	// Get details of any primary keys
	DataColumn[] primaryKeyCols = dt.PrimaryKey;
	if (1 != primaryKeyCols.Length)
 	  Console.WriteLine("FAIL: # of columns comprising primary key wrong {0} != {1}",
		1, primaryKeyCols.Length);

	Console.WriteLine ("Primary key details:");
	Console.WriteLine("\tNo. of columns comprising key = " + primaryKeyCols.Length);
	Console.WriteLine("\tComponent columns of primary key:");
	for (int i = 0; i < primaryKeyCols.Length; i++)
	{
		// Allow for DBMSes which don't support mixed-case identifiers.
		if (String.Compare("CUSTOMERID", primaryKeyCols[i].ColumnName.ToUpper()) != 0)
		  Console.WriteLine("FAIL: Primary key wrong {0} != {1}",
			"CUSTOMERID", primaryKeyCols[i].ColumnName.ToUpper());
		Console.WriteLine("\t\t" + primaryKeyCols[i].ColumnName + "  (" + 
			primaryKeyCols[i].DataType + ")");
	}
    }
  }

}

}

--------------000303080806060007060002
Content-Type: text/plain;
 name="DataAdapterUpdate1.cs"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="DataAdapterUpdate1.cs"

namespace Tests
{

using System;
using System.Data;
using System.Data.Common;
using SQLServer = OpenLink.Data.SQLServer;

public class DataAdapterUpdate1
{
  static string connStr = "SVT=SQLServer2000;DATABASE=pubs;UID=sa;Server=pcwin;PWD=;";

  public static void Main ()
  {
    DataAdapterUpdate1 myDataAdapter = new DataAdapterUpdate1 ();
    myDataAdapter.Run ();
  }

  public void Run ()
  {
    IDbConnection myConnection;
    DbDataAdapter myDataAdapter;

    myConnection = new SQLServer.OPLConnection (connStr);
    myDataAdapter = new SQLServer.OPLDataAdapter(
    	    "Select * from UCSRegions", (SQLServer.OPLConnection) myConnection);

    IDataParameter workParam = null;

    // Restore database to it's original condition so sample will work correctly.
    Cleanup ();

    // Build the insert Command
    ((IDbDataAdapter)myDataAdapter).InsertCommand = myConnection.CreateCommand ();
    ((IDbDataAdapter)myDataAdapter).InsertCommand.CommandText = "insert into UCSRegions (RegionID, RegionDescription) VALUES (?, ?)";

    workParam = ((IDbDataAdapter)myDataAdapter).InsertCommand.CreateParameter ();
    workParam.ParameterName = "RegionID";
    workParam.DbType = DbType.Int32;
    workParam.SourceColumn = "RegionID";
    workParam.SourceVersion = DataRowVersion.Current;
    ((IDbDataAdapter)myDataAdapter).InsertCommand.Parameters.Add(workParam); 


    workParam = ((IDbDataAdapter)myDataAdapter).InsertCommand.CreateParameter ();
    workParam.ParameterName = "RegionDescription";
    workParam.DbType = DbType.String;
    workParam.SourceColumn = "RegionDescription";
    workParam.SourceVersion = DataRowVersion.Current;
    ((IDbDataAdapter)myDataAdapter).InsertCommand.Parameters.Add (workParam);

    // Build the update command
    ((IDbDataAdapter)myDataAdapter).UpdateCommand = myConnection.CreateCommand ();
    ((IDbDataAdapter)myDataAdapter).UpdateCommand.CommandText = "update UCSRegions set RegionDescription = ? WHERE RegionID = ?" ; 

    workParam = ((IDbDataAdapter)myDataAdapter).UpdateCommand.CreateParameter ();
    workParam.ParameterName = "RegionDescription";
    workParam.DbType = DbType.String;
    workParam.SourceVersion = DataRowVersion.Current;
    workParam.SourceColumn = "RegionDescription";
    ((IDbDataAdapter)myDataAdapter).UpdateCommand.Parameters.Add (workParam);
		
    workParam = ((IDbDataAdapter)myDataAdapter).UpdateCommand.CreateParameter ();
    workParam.ParameterName = "RegionID";
    workParam.DbType = DbType.Int32;
    workParam.SourceColumn = "RegionID";
    workParam.SourceVersion = DataRowVersion.Original;
    ((IDbDataAdapter)myDataAdapter).UpdateCommand.Parameters.Add (workParam);

    DataSet myDataSet = new DataSet();

    // Set the MissingSchemaAction property to AddWithKey because Fill will
    // not cause primary key & unique key information to be retrieved unless
    // AddWithKey is specified.
    myDataAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
    myDataAdapter.Fill (myDataSet, "UCSRegions");

    DataRow myDataRow1 = myDataSet.Tables["UCSRegions"].Rows.Find (2);
    myDataRow1[1] = "Changed this region desc";

    DataRow myDataRow2 = myDataSet.Tables["UCSRegions"].NewRow ();
    myDataRow2[0] = 901;
    myDataRow2[1] = "A new region";
    myDataSet.Tables["UCSRegions"].Rows.Add (myDataRow2);

    try
    {
      myDataAdapter.Update(myDataSet, "UCSRegions");
      Console.Write("Updating DataSet succeeded!");
    }
    catch(Exception e)
    {
      Console.Write(e.ToString());
    }
  }

  public void Cleanup()
  {
    IDbConnection myConnection;

    myConnection = new SQLServer.OPLConnection (connStr);

    try
    {
      // Restore database to it's original condition so test app will work 
      // correctly.
      myConnection.Open ();
      IDbCommand CleanupCommand = myConnection.CreateCommand ();
      CleanupCommand.CommandText = 
	"DELETE FROM UCSRegions WHERE RegionID = 901";
      CleanupCommand.ExecuteNonQuery();
    }
    catch (Exception e)
    {
      Console.Write(e.ToString());
    }
    finally
    {
      myConnection.Close();
    }
  }
}

}

--------------000303080806060007060002
Content-Type: text/plain;
 name="create_table.sql"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="create_table.sql"

if exists (select * from sysobjects where id = object_id('dbo.UCSCustomers') and sysstat & 0xf = 3)
	drop table "dbo"."UCSCustomers"

CREATE TABLE "UCSCustomers" (
	"CustomerID" nchar (5) NOT NULL ,
	"CompanyName" nvarchar (40) NOT NULL ,
	"ContactName" nvarchar (30) NULL ,
	"ContactTitle" nvarchar (30) NULL ,
	"Address" nvarchar (60) NULL ,
	"City" nvarchar (15) NULL ,
	"Region" nvarchar (15) NULL ,
	"PostalCode" nvarchar (10) NULL ,
	"Country" nvarchar (15) NULL ,
	"Phone" nvarchar (24) NULL ,
	"Fax" nvarchar (24) NULL ,
	CONSTRAINT "PK_Customers" PRIMARY KEY  CLUSTERED 
	(
		"CustomerID"
	)
)
GO


INSERT UCSCustomers VALUES('ALFKI','Alfreds Futterkiste','Maria Anders','Sales Representative','Obere Str. 57','Berlin',NULL,'12209','Germany','030-0074321','030-0076545')
INSERT UCSCustomers VALUES('ANATR','Ana Trujillo Emparedados y helados','Ana Trujillo','Owner','Avda. de la Constitucion 2222','Mexico D.F.',NULL,'05021','Mexico','(5) 555-4729','(5) 555-3745')
INSERT UCSCustomers VALUES('VINET','Vins et alcools Chevalier','Paul Henriot','Accounting Manager','59 rue de l''Abbaye','Reims',NULL,'51100','France','26.47.15.10','26.47.15.11')
INSERT UCSCustomers VALUES('TOMSP','Toms Spezialitaten','Karin Josephs','Marketing Manager','Luisenstr. 48','Munster',NULL,'44087','Germany','0251-031259','0251-035695')
INSERT UCSCustomers VALUES('HANAR','Hanari Carnes','Mario Pontes','Accounting Manager','Rua do Paco, 67','Rio de Janeiro','RJ','05454-876','Brazil','(21) 555-0091','(21) 555-8765')
INSERT UCSCustomers VALUES('VICTE','Victuailles en stock','Mary Saveley','Sales Agent','2, rue du Commerce','Lyon',NULL,'69004','France','78.32.54.86','78.32.54.87')
INSERT UCSCustomers VALUES('SUPRD','Supremes delices','Pascale Cartrain','Accounting Manager','Boulevard Tirou, 255','Charleroi',NULL,'B-6000','Belgium','(071) 23 67 22 20','(071) 23 67 22 21')
GO




if exists (select * from sysobjects where id = object_id('dbo.UCSOrders') and sysstat & 0xf = 3)
	drop table "dbo"."UCSOrders"

CREATE TABLE "UCSOrders" (
	"OrderID" "int" NOT NULL ,
	"CustomerID" nchar (5) NULL ,
	"EmployeeID" "int" NULL ,
	"OrderDate" "datetime" NULL ,
	"RequiredDate" "datetime" NULL ,
	"ShippedDate" "datetime" NULL ,
	"ShipVia" "int" NULL ,
	"Freight" "money" NULL ,
	"ShipName" nvarchar (40) NULL ,
	"ShipAddress" nvarchar (60) NULL ,
	"ShipCity" nvarchar (15) NULL ,
	"ShipRegion" nvarchar (15) NULL ,
	"ShipPostalCode" nvarchar (10) NULL ,
	"ShipCountry" nvarchar (15) NULL ,
	CONSTRAINT "PK_Orders" PRIMARY KEY  CLUSTERED 
	(
		"OrderID"
	),
)
GO




INSERT UCSOrders VALUES(10248, 'VINET', 5, '4/7/1996',  '8/1/1996',  '7/16/1996', 3, 32.38, 'Vins et alcools Chevalier', '59 rue de l'Abbaye', 'Reims', null, '51100', 'France')
INSERT UCSOrders VALUES(10274, 'VINET', 6, '8/6/1996',  '9/3/1996',  '8/16/1996', 1, 6.01, 'Vins et alcools Chevalier', '59 rue de l'Abbaye', 'Reims', null, '51100', 'France')
INSERT UCSOrders VALUES(10249, 'TOMSP', 6, '7/5/1996',  '8/16/1996', '7/10/1996', 1, 11.61, 'Toms Spezialitaten', 'Luisenstr. 48', 'Munster', null, '44087', 'Germany')
INSERT UCSOrders VALUES(10438, 'TOMSP', 3, '2/6/1997',  '3/6/1997',  '2/14/1997', 2, 8.24, 'Toms Spezialitaten', 'Luisenstr. 48', 'Munster', null, '44087', 'Germany')
INSERT UCSOrders VALUES(10446, 'TOMSP', 6, '2/14/1996', '3/14/1996', '2/19/1996', 1, 14.68, 'Toms Spezialitaten', 'Luisenstr. 48', 'Munster', null, '44087', 'Germany')
INSERT UCSOrders VALUES(10250, 'HANAR', 4, '7/8/1996',  '8/5/1996',  '7/12/1996', 2, 65.83, 'Hanari Carnes', 'Rua do Paco, 67', 'Rio de Janeiro', 'RJ', '05454-876', 'Brazil')
INSERT UCSOrders VALUES(10251, 'VICTE', 3, '7/8/1996',  '8/5/1996',  '7/15/1996', 1, 41.34, 'Victuailles en stock', '2, rue du Commerce', 'Lyon', null, '69004', 'France')
INSERT UCSOrders VALUES(10334, 'VICTE', 8, '10/21/1996','11/18/1996','10/28/1996', 2, 8.56, 'Victuailles en stock', '2, rue du Commerce', 'Lyon', null, '69004', 'France')
INSERT UCSOrders VALUES(10252, 'SUPRD', 4, '7/9/1996',  '8/6/1996',  '7/11/1996', 2, 51.30, 'Supremes delices', 'Boulevard Triou, 255', 'Charleroi', null, 'B-6000', 'Belgium')
INSERT UCSOrders VALUES(10643, 'ALFKI', 6, '8/25/1997', '9/22/1997', '9/2/1997', 1, 29.46, 'Alfreds Futterkiste', 'Obere Str. 57', 'Berlin', null, '12208', 'Germany')
INSERT UCSOrders VALUES(10692, 'ALFKI', 4, '10/3/1997', '10/31/1997','10/13/1997', 2, 61.02, 'Alfreds Futterkiste', 'Obere Str. 57', 'Berlin', null, '12208', 'Germany')
INSERT UCSOrders VALUES(10702, 'ALFKI', 4, '10/13/1997','11/24/1997','10/21/1997', 1, 23.94, 'Alfreds Futterkiste', 'Obere Str. 57', 'Berlin', null, '12208', 'Germany')
INSERT UCSOrders VALUES(10835, 'ALFKI', 1, '1/15/1998', '2/12/1998', '1/21/1998', 3, 69.53, 'Alfreds Futterkiste', 'Obere Str. 57', 'Berlin', null, '12208', 'Germany')
INSERT UCSOrders VALUES(10952, 'ALFKI', 1, '3/16/1998', '4/27/1998', '3/24/1998', 1, 40.42, 'Alfreds Futterkiste', 'Obere Str. 57', 'Berlin', null, '12208', 'Germany')
INSERT UCSOrders VALUES(11011, 'ALFKI', 3, '4/9/1998',  '5/7/1998',  '4/13/1998', 1, 1.21, 'Alfreds Futterkiste', 'Obere Str. 57', 'Berlin', null, '12208', 'Germany')
INSERT UCSOrders VALUES(10926, 'ANATR', 4, '3/4/1998',  '4/1/1998',  '3/11/1998', 3, 39.92, 'Ana Trujillo Emparedados y ...', 'Avda. de la Constitucion 2222', 'Mexico D.F.', null, '05021', 'Mexico')
INSERT UCSOrders VALUES(10759, 'ANATR', 3, '11/28/1997','12/26/1997','12/12/1997', 3, 11.99, 'Ana Trujillo Emparedados y ...', 'Avda. de la Constitucion 2222', 'Mexico D.F.', null, '05021', 'Mexico')
INSERT UCSOrders VALUES(10625, 'ANATR', 3, '8/8/1997',  '9/5/1997',  '8/14/1997', 1, 43.90, 'Ana Trujillo Emparedados y ...', 'Avda. de la Constitucion 2222', 'Mexico D.F.', null, '05021', 'Mexico')
INSERT UCSOrders VALUES(10308, 'ANATR', 7, '9/18/1996', '10/16/1996','9/24/1996', 3, 1.61, 'Ana Trujillo Emparedados y ...', 'Avda. de la Constitucion 2222', 'Mexico D.F.', null, '05021', 'Mexico')
GO



if exists (select * from sysobjects where id = object_id('dbo.UCSRegions') and sysstat & 0xf = 3)
	drop table "dbo"."UCSRegions"

CREATE TABLE "UCSRegions" (
	"RegionID" "int" NOT NULL ,
	"RegionDescription" nvarchar (50) NULL ,
	CONSTRAINT "PK_Regions" PRIMARY KEY  CLUSTERED 
	(
		"RegionID"
	),
)
GO


INSERT INTO UCSRegions VALUES(1, 'Eastern')
INSERT INTO UCSRegions VALUES(2, 'Western')
INSERT INTO UCSRegions VALUES(3, 'Northern')
INSERT INTO UCSRegions VALUES(4, 'Southern')
INSERT INTO UCSRegions VALUES(901, 'Alaskan wastelands')
INSERT INTO UCSRegions VALUES(100, 'MidWestern')
INSERT INTO UCSRegions VALUES(101, 'MidEastern')
GO

--------------000303080806060007060002
Content-Type: text/plain;
 name="build.bat"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="build.bat"

csc /nologo /debug+ /d:DEBUG  /t:exe /R:System.dll /R:System.Data.dll /R:OpenLink.Data.SQLServer.dll /out:./CmdBuilder1.exe CmdBuilder1.cs 
csc /nologo /debug+ /d:DEBUG  /t:exe /R:System.dll /R:System.Data.dll /R:OpenLink.Data.SQLServer.dll /out:./DataAdapterUpdate1.exe DataAdapterUpdate1.cs 
csc /nologo /debug+ /d:DEBUG  /t:exe /R:System.dll /R:System.Data.dll /R:OpenLink.Data.SQLServer.dll /out:./DataAdapterFillSchema1.exe DataAdapterFillSchema1.cs 

--------------000303080806060007060002--