Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Try and catch not working
Message
From
15/08/2008 01:24:25
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Try and catch not working
Environment versions
Environment:
ASP.NET
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Oracle
Miscellaneous
Thread ID:
01339066
Message ID:
01339066
Views:
60
Dear All,

I am expecting to see a nice and friendly "caught an exception" in DetailView itemInserting event below.. but it doesnot work ..
could any body please explain.. what I missed?

Regards
Winanjaya


Private Sub DetailsView1_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewInsertEventArgs) Handles DetailsView1.ItemInserting

Dim log As System.Diagnostics.EventLog = New System.Diagnostics.EventLog

Try

Catch ex As OracleException
Dim errMsg As String = "Code: " & ex.Code & vbCrLf & _
"Message: " & ex.Message
e.Cancel = True
log.Source = "My Application"
log.WriteEntry(errMsg)
Console.WriteLine("An Oracle exception occurred, please contact your system Administrator.")

Catch ex As Exception
Dim errMsg As String = ex.Message
e.Cancel = True
log.Source = "My Application"
log.WriteEntry(errMsg)
Console.WriteLine("An other exception occurred, please contact your system Administrator.")

Finally

End Try

End Sub
Next
Reply
Map
View

Click here to load this message in the networking platform