我在 vb.net 和 Oracle 数据库中有一个项目。当用户密码在 oracle 中过期时导致 oracle exeption。我处理了那个异常(打开一个 ChangePassword 表单并更改了密码),但是我丢失了当错误出现时我准备执行的过程:
示例:
Try
conn = New OracleConnection
conn.ConnectionString = gApp.ConnectString
conn.Open()
'Let's say that error appears here, I want to retun here after password has been changed
cmd.Connection = conn
cmd.CommandText = "Delete_Transaction"
cmd.CommandType = CommandType.StoredProcedure
OracleCommandBuilder.DeriveParameters(cmd)
cmd.Parameters("in_transaction_id").Value = TransactionId
cmd.ExecuteNonQuery()
conn.Close()
Catch ex As OracleException
'PseudoCode: if error is PasswordExpired->open the ChengePassForm...blah,blah
'is handled by a Error class that i have
Finally
If Not conn Is Nothing Then
conn.Dispose()
End If
End Try
主要问题是代码中到处都可能出现问题,我的意思是不同的程序,不同的形式等。
所以我需要一个通用的解决方案。实际上我什至无法想象一个正确的逻辑来解决这个问题?谁能告诉我一个方向?