|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
SqlDataSource is doing an Update after handeling an Insert exceptiI 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? -- Mark 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? -- Show quoteHide quoteMark "masmith" wrote: > 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? > -- > Mark
CustomValidator
DropDownList Input Control disappears Alternative to asp:MenuControl? Upload Excel Spreadsheet GridView Edit Template Control Style Page Panels How to prevent JavaScript conflict in custom server control (when added more than once to a page) Control disappears Enter key as select/submit button |
|||||||||||||||||||||||