在InvalidOperationException
的{{1}}方法中,我可以抓住.Open()
SqlConnection
在Private Function InsertSomeData() As Boolean
Using SqlCon As New SqlConnection(ConnectionString)
Try
SqlCon.Open()
Catch sqlEx as SqlException
MessageBox.Show("Error occured while connecting to database!", "Warning", MessageBoxButtons.Ok, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
Return False
Catch invOpException As InvalidOperationExcpetion
'what should go here? Connection is open so I just want to continue
End Try
'some more code
End Using
End Function
之后,注释区域应该有什么内容?我什至不希望记录此日志,只是因为某种原因连接已经打开,所以继续。