Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Try and catch not working
Message
De
15/08/2008 01:24:25
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Try and catch not working
Versions des environnements
Environment:
ASP.NET
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Oracle
Divers
Thread ID:
01339066
Message ID:
01339066
Vues:
61
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform