SqlDataSource is doing an Update after handeling an Insert excepti

M

masmith

I am using VS 2008 to create a ASP.NET 3.5 web page with a third party grid
control and a SQLDataSource. I have found that adding events for the
SQLDataSource control to handle exceptions that occure during Insert or
Update does work. The problem is when I set the e.ExceptionHandled = true in
Inserted event, the SQLDataSource then fires an update. This is a problem as
the error is being caused by a duplicate key violation. Thus it is updating
the vaild or original row with the duplicate key value with the new insert
values.

I believe the problem is in the SQLDataSource control code as the Insert and
the Update are occuring in the same postback and the update fires as soon as
the insert is complete.

Has anyone else seen this behavior and found a solution?
 
M

masmith

I found that the sqldatasource inserting event has the same problem where I
e.cancel = true when I determine a duplicate key value has been entered. It
cancels the insert but still fires the database update.

Also I am using Infragistics UltraWebGrid connected to the SQLDataSource. I
do not believe it is the problem, but I am posting a message with there
support in case I am wrong and it is the server based code for the WebGrid
that is firing the update.

Has anyone seen this problem when using the SQLDataSource?
If yes what control or controls where you binding to the SQLDataSource?
 

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

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top