|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
try/catch error************************************************************* Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30616: Variable 'exc' hides a variable in an enclosing block. Source Error: Line 340: Try Line 341: dbReader = myDbObject.RunProcedure("AddNewHire", parameters) Line 342: Catch exc as exception Line 343: ErrorMessage.Text = "Unable to add new hire at this time" Line 344: Finally *********************************************************************** Sub SubmitNewHire_Click(s as Object, e as ImageClickEventArgs) Dim exc as Integer .... Try dbReader = myDbObject.RunProcedure("AddNewHire", parameters) Catch exc as exception ErrorMessage.Text = "Unable to add new hire at this time" Finally dbReader.Close() End Try .... End Sub What is "exc" hiding? Thanks, Tom Your "catch" is not catching your variable but a System.Exception object
You declare exc has an Integer "Dim exc as Integer", then you're trying to Catch an exception with the same name. Just use a different name for your exception like: "Catch ex1 as exception" Show quote "tshad" <tscheider***@ftsolutions.com> wrote in message news:%23hqORnmXGHA.1228@TK2MSFTNGP02.phx.gbl... > Why am I getting this error: > > ************************************************************* > Compilation Error > Description: An error occurred during the compilation of a resource > required to service this request. Please review the following specific > error details and modify your source code appropriately. > > Compiler Error Message: BC30616: Variable 'exc' hides a variable in an > enclosing block. > > Source Error: > > Line 340: Try > Line 341: dbReader = myDbObject.RunProcedure("AddNewHire", parameters) > Line 342: Catch exc as exception > Line 343: ErrorMessage.Text = "Unable to add new hire at this time" > Line 344: Finally > *********************************************************************** > > Sub SubmitNewHire_Click(s as Object, e as ImageClickEventArgs) > Dim exc as Integer > ... > Try > dbReader = myDbObject.RunProcedure("AddNewHire", parameters) > Catch exc as exception > ErrorMessage.Text = "Unable to add new hire at this time" > Finally > dbReader.Close() > End Try > ... > End Sub > > What is "exc" hiding? > > Thanks, > > Tom >
Other interesting topics
|
|||||||||||||||||||||||