DBConcurrency Exception Handling

G

Guest

hi,
I am creating a dbconcurrencyexception in my program. Update fails with 0
rows affected message. Because I changed the data in DB from SQL server
front-end after my grid fills with data. i followed the example in msdn. in
the handler, after prompting the user, i read the record from the DB and
merge it with the current dataset. And try to update db again. The result is
the same exception. Because merge does not override the original version of
the record in the grid. So what should i do to handle this exception?

Salim
 
G

Guest

hi,
The primary key is not affected. I think, i solved the problem by changing
the dataadapter.updatecommand. Before that the updatecommand was looking for
the exact row it readed during fill, which is not available anymore.

Thanks,
Salim

Miha Markic said:
Hi Salim,

Do you have a primary key in DataTable being affected?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

Salim said:
hi,
I am creating a dbconcurrencyexception in my program. Update fails with 0
rows affected message. Because I changed the data in DB from SQL server
front-end after my grid fills with data. i followed the example in msdn.
in
the handler, after prompting the user, i read the record from the DB and
merge it with the current dataset. And try to update db again. The result
is
the same exception. Because merge does not override the original version
of
the record in the grid. So what should i do to handle this exception?

Salim
 

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