On Wed, 11 Feb 2004 05:36:23 GMT,
(E-Mail Removed) (Tian
Min Huang) wrote:
>Hello Nick,
>
>Thanks for your post. As I understand, the problem you are facing is that
>it throws DBConcurrencyException when calling DbDataAdapter.Update method.
>By default, the Update method ends and raises a DBConcurrencyException
>exception when the method encounters a row that fails to update. I think
>more information is needed before moving forward:
>
>1. What's the database, SQL Server, Microsoft Access, etc?
It's MSAccess.
>
>2. In the DataRow, does it contain the "System.Data.OleDb.OleDbType.DBDate"
>type for mapping DateTime data? If so, based on my experience, there is a
>known issue to cause such error and we need to use
>System.DataOleDb.OleDbType.Date instead of
>System.Data.OleDb.OleDbType.DBDate.
Here's the code to create the updatecommand for oleDbDataAdapter1:
updatesql = "UPDATE tbprivate SET dancerid = @dancerid, len = @len,
start = @start, pdancer = @pdancer, pclub = @pclub, room = @room,
finished = @finished, cancelled = @cancelled, shift = #" + GetShift()
+ "# WHERE privateid = @privateid";
where GetShift() will return a date like "2/8/2004".
oleDbDataAdapter1.UpdateCommand = new
OleDbCommand(updatesql,oleDbConnection1);
oleDbDataAdapter1.UpdateCommand.Parameters.Add("@privateid",
OleDbType.BigInt,4, "privateid");
oleDbDataAdapter1.UpdateCommand.Parameters.Add("@dancerid",
OleDbType.BigInt,4, "dancerid");
oleDbDataAdapter1.UpdateCommand.Parameters.Add("@len",
OleDbType.TinyInt,1, "len");
oleDbDataAdapter1.UpdateCommand.Parameters.Add("@room",
OleDbType.VarChar,1, "room");
oleDbDataAdapter1.UpdateCommand.Parameters.Add("@start",
OleDbType.VarChar,5, "start");
oleDbDataAdapter1.UpdateCommand.Parameters.Add("@pclub",
OleDbType.TinyInt,4, "pclub");
oleDbDataAdapter1.UpdateCommand.Parameters.Add("@pdancer",
OleDbType.TinyInt,4, "pdancer");
oleDbDataAdapter1.UpdateCommand.Parameters.Add("@finished",
OleDbType.Boolean,1, "finished");
oleDbDataAdapter1.UpdateCommand.Parameters.Add("@cancelled",
OleDbType.Boolean,1, "cancelled");
oleDbDataAdapter1.UpdateCommand.Parameters.Add("@shift",
OleDbType.Date,0, "shift");