Concurrency violation: The update command 0 rows affected

D

Dzemo

i use this code to get data into dataset

cmd.CommandType = CommandType.Text

cmdUpdate.CommandType = CommandType.Text

cmdUpdate.CommandText = "Update BigOne Set Rezultat=? where ID=?"

cmdUpdate.Parameters.Add("Rezultat", OleDb.OleDbType.Char, 30, "Rezultat")

cmdUpdate.Parameters.Add("ID", OleDb.OleDbType.Integer, 6, "ID")

cmdUpdate.Parameters("ID").SourceVersion = DataRowVersion.Original

'todo: vidi ovu komandu

da.SelectCommand = cmd

da.UpdateCommand = cmdUpdate

cmd.CommandText = "SELECT sections.ID, Analize.Name as Analiza,
BigOne.Rezultat FROM BigOne INNER JOIN Analize ON BigOne.IDAnalize =
Analize.ID INNER JOIN Sections ON Analize.IDSekcije = Sections.ID WHERE
BigOne.BrojProtokola Like '" & txtBroPro.Tekst.Trim & "'"

da.Fill(ds, "Sekcije")

and then use dataview object to filter data and fill various datagrids on my
form. Datagrids aro on diferent TabPages. When i click on btnOK whit this
code

da.Update(ds.Tables(0))

I get mentioned error in subject:

Concurrency violation: The UpdateCommand affected?

What is problem
 
U

Uri Dor

either another user has changes the data in the DB between your Fill and
Update
or you've misused AcceptChanges
 
M

Mike Dole

Just had a hell of a time figuring out why I got this error, I used a
pretty straightforward 'select command' a commandbuilder,
getupdatecommand showed a 'normal' update command, MyDs.hadchanges, 1
or more rowstates where modified,etc,etc

After 4 hours browsing newsgroups I doublechecked my access database.
It had a decimal field in it (2 decimals I believe) just turned it
into an integer and guess what, problem solved!

Still have to find out if it had something to do with the decimal
thing but I can recall having a table as a datagrid's datasource and
the formatting I gave to the grid did some pretty nasty things to my
update command (didn't format the datagrid in this case however..)

Anyway, check your database table (fields, use of reserved words, etc)
it might help..

Regards,

Mike
 
M

Mike Dole

Changing the type in the database from decimal to double (with 2
decimals) did the trick!

Regards,

Mike
 
M

Mike Dole

Changing the type in the database from decimal to double (with 2
decimals) did the trick!

Regards,

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top