Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do I make try statement work again?

Status
Not open for further replies.

Bob2

Programmer
Jul 3, 2000
228
SE
Hi

I have in ASP 1.0 used this code without any trouble..

<code>

<script language=&quot;VB&quot; runat=&quot;server&quot;>
Sub Page_Load(Source as Object, E as EventArgs)
If not Page.IsPostBack then
BindGrid
end If
End Sub

Sub BindGrid()
Try

My database connection

Catch SQLexc as sqlexception
Catch exc as exception
'MyError.Text = exc.tostring()
MyError.Text = &quot;trouble&quot;
End Try
End Sub

</script>

</code>


But since I installed 1.1 I get error telling me &quot; 'exception' is not accessible in this context because it is 'Private' &quot;.
I doesn't use code behind files so how do I make this work again?


Regards


M
 
Well, in code behind files the syntax would be:

Try
'code here

Catch err as Exception
'code to handle exception

Finally
'code to execute no matter if an error is caught or not
'this is optional though

End Try

And in the code behind you get an error if you don't include the Catch statement. So that could be it?

hth

D'Arcy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top