|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Strange concurrency errorI have a perfectly working vs 2003 winform data app. All the data access code has been generated using the data adapter wizard and then pasted into the app. I had to add a new field in the backend access db which I did. I then dragged the table to the dataset and deleted the old table from the dataset it so the dataset can see the new field as well. The problem is that when in update command code I add these two lines Me.updcomCompanies.Parameters.Add(New System.Data.OleDb.OleDbParameter("Web_Enabled", System.Data.OleDb.OleDbType.Boolean, 2, "Web_Enabled")) and Me.updcomCompanies.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_Web_Enabled", System.Data.OleDb.OleDbType.Boolean, 2, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Web_Enabled", System.Data.DataRowVersion.Original, Nothing)) I startgetting a data concurrency error on mydataadapter.update() method. I know that there is no data concurrency problem as I am the only user testing the app. Obviously the error is misleading. What can I do from here to fix this problem? Thanks Regards Hi,
Show quote "John" <John@nospam.infovis.co.uk> wrote in message You say added these lines, not sure if they came from the wizard too, but news:ufP4F3RWHHA.3980@TK2MSFTNGP02.phx.gbl... > Hi > > I have a perfectly working vs 2003 winform data app. All the data access > code has been generated using the data adapter wizard and then pasted into > the app. > > I had to add a new field in the backend access db which I did. I then > dragged the table to the dataset and deleted the old table from the > dataset it so the dataset can see the new field as well. > > The problem is that when in update command code I add these two lines > > Me.updcomCompanies.Parameters.Add(New > System.Data.OleDb.OleDbParameter("Web_Enabled", > System.Data.OleDb.OleDbType.Boolean, 2, "Web_Enabled")) > > and > > Me.updcomCompanies.Parameters.Add(New > System.Data.OleDb.OleDbParameter("Original_Web_Enabled", > System.Data.OleDb.OleDbType.Boolean, 2, > System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, > Byte), "Web_Enabled", System.Data.DataRowVersion.Original, Nothing)) why didn't you configurated the DataAdapter again and copy-pasted it _all_, just to be sure ? False concurrency violations aren't always easy to fix definately not without seeing full code and maybe the db unless it's simple. There are many reasons that can cause it: - calling AcceptChanges at the wrong time - not filling all the columns - not retrieving auto-generated keys (this can be easily spot, because it occurs after insert-update-change-update) - other key problems .... You could add an eventhandler to DataAdapter.RowUpdating, check for e.StatementType is Update and then check e.Command, print out the sql text and all parameter(+values), the old values must be the same as they are in the DB and check if the key is correct. You haven't really said when they occur, simple change-update or delete too, sometimes or always,etc... ? HTH, Greetings Show quote > I startgetting a data concurrency error on mydataadapter.update() method. > I know that there is no data concurrency problem as I am the only user > testing the app. Obviously the error is misleading. What can I do from > here to fix this problem? > Thanks > > Regards > |
|||||||||||||||||||||||