General information
Title:
Try and catch not working
Environment versions
Network:
Windows 2003 Server
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only