One thing I noticed right away is that the error message that your stored procedure is raising "Updation failed. record already exists" does not match the text string, "Updation failed. record Not exists", that you are checking in your try/catch block.
views:
295answers:
3
A:
tchester
2009-11-11 12:20:33
Thank You. But the catch block is not catching the error.
Geetha
2009-11-11 12:25:22
+1
A:
The Updating event is used to customize the SqlCommand being executed, but it does not execute the command. The try/catch block must wrap the actual place where the command is executed, not the customization callback.
Remus Rusanu
2009-11-11 19:07:24
A:
Hi all,
Thank You for all your replies.
By using a e.Exception in sqlDataSource_Updated my problem got solved.
protected void sqlDataSource_Updated(object sender, SqlDataSourceStatusEventArgs e)
{
if (e.Exception != null) { // If so, checks the Exception message if (e.Exception.Message == "Updation failed. Product already exists") { if (e.Exception != null)
{
// If so, checks the Exception message
if (e.Exception.Message == "record already exists")
{
}
}
Geetha
2009-11-12 11:41:13