Re: Asp .Net - Try Catch

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Chetan Panchal (Chetan_at_TheGT.com)
Date: 05/14/04


Date: Fri, 14 May 2004 14:37:03 +0530

Dianna wrote:
> I am doing an update inside a 'Try Catch'. It seems it is having an error on one of the lines within the 'Try' however, instead of running Catch code it sends an error page. I have done many 'Try Catch' in client server and never had a problem. Is this different in ASP?
>
> Here is code snippit:
>
> Line 140: Try
> Line 141: 'Call update on the adapter to commit the changes, catch any exceptions that may be raised.
> Line 142: sqlDataAdp.Update(ds)
> Line 143: ClearMessages()
> Line 144: DisplayMessages("Update Successful")
> Line 145: Catch ex as exception
> Line 146: DisplayMessages("Error updating table",ex.message.tostring)
>
>
> It has the error on line 142 and then displays an error page:
>
> Update unable to find TableMapping['Table'] or DataTable 'Table'.
> Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
>
> Exception Details: System.InvalidOperationException: Update unable to find TableMapping['Table'] or DataTable 'Table'.
>
>
Does it display "Update Successful" as well? if yes, then somebody
already handled exception.