471,079 Members | 928 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,079 software developers and data experts.

Strange concurrency error

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_Ena bled",
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
Feb 25 '07 #1
1 1139
Hi,

"John" <Jo**@nospam.infovis.co.ukwrote in message
news:uf**************@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_Ena bled",
System.Data.OleDb.OleDbType.Boolean, 2,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "Web_Enabled", System.Data.DataRowVersion.Original, Nothing))
You say added these lines, not sure if they came from the wizard too, but
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

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

Feb 25 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Robert Schuldenfrei | last post: by
6 posts views Thread by WSobczuk | last post: by
4 posts views Thread by Bob | last post: by
5 posts views Thread by John | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.