c# - DataAdapter Raises a concurreny violation exception when using UpdateBatchSize -


I am using a data adapter and I am updating my data very well with no problem , But I get an exception when I use UpdateBatchSize property: "Narrow violation: The batch command affects 0 of 2 impressions affected." Line The codes below are part of my DAL

  myAdapter.InsertCommand = InsertCmd (); myAdapter.InsertCommand.UpdatedRowSource = System.Data.UpdateRowSource.None; MyAdapter.DeleteCommand = DeleteCmd (); myAdapter.DeleteCommand.UpdatedRowSource = System.Data.UpdateRowSource.None; MyAdapter.UpdateCommand = UpdateCmd (); myAdapter.UpdateCommand.UpdatedRowSource = System.Data.UpdateRowSource.None; MyAdapter.SelectCommand.Connection = myConnection.conn; MyAdapter.InsertCommand.Connection = myConnection.conn; MyAdapter.UpdateCommand.Connection = myConnection.conn; MyAdapter.DeleteCommand.Connection = myConnection.conn; MyAdapter.AcceptChangesDuringUpdate = false; MyAdapter.UpdateBatchSize = 2; Try {MyAdapter.Update (dt.GetChanges ()); } Hold {throw; }    

What I found after searching, you use the Adapter UpdateBatchSize property With the optimal concurrency provided with your SQL command, the command will fail for the timestamp column size or concurrency check for each column, so the SQL command will be very large, so you can not get everything

If you use the updatebate system to reduce the server If you want to use, you can get rid of the timestamp column check in your SQLandend or in the concurrency option available in your SQL adapter.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -