Hi all,

I am having a problem with using SqlCeDataAdapter to update the
database. I am working with the dataset and the data adapter to do my
Select,Insert,Update,Delete . The Dataset holds the results of the
select commmand and I store the adapter in a Hashtable .When the user
does an insert ,I retrieve this adapter from the Hashtable , set the
Insert command and update the adapter.This works fine and I am able to
insert multiple rows . The problem appears when I try to update a newly
inserted row , one that was not displayed in the search results when
the application loaded this form. Then I get a Concurrency violation ,
No records updated exception . The same goes for deleted rows . Can
some one tell me what is happening ?.Also how do I go about solving
this problem?.

Thanks,
Raja

Re: Concurrency Violations in SqlCeDataAdapter by Bart

Bart
Tue Nov 29 06:32:28 CST 2005

Hi,

"Raja" <lexraja@gmail.com> wrote in message
news:1133221687.366199.275120@g44g2000cwa.googlegroups.com...
> Hi all,
>
> I am having a problem with using SqlCeDataAdapter to update the
> database. I am working with the dataset and the data adapter to do my
> Select,Insert,Update,Delete . The Dataset holds the results of the
> select commmand and I store the adapter in a Hashtable .When the user
> does an insert ,I retrieve this adapter from the Hashtable , set the
> Insert command and update the adapter.This works fine and I am able to
> insert multiple rows . The problem appears when I try to update a newly
> inserted row , one that was not displayed in the search results when
> the application loaded this form. Then I get a Concurrency violation ,
> No records updated exception . The same goes for deleted rows . Can
> some one tell me what is happening ?.Also how do I go about solving
> this problem?.

I'm not very familar with SqlCeDataAdapter, but the problem you're
describing can be caused by _not_ getting the autogenerated key from the DB
after inserting a new record.
Do you have an autogenerated primary key column ? In case you do, then are
you doing anything to get the key generated by the DB upon insert (because
the DataSet itself just uses temporal keys for inserted records) ?
If those temporal keys aren't updated with the ones actually used in the DB
then all subsequent updating or deleting will fail with a concurrency
violation.


HTH,
Greetings



>
> Thanks,
> Raja
>