It used to be asey in VB6 to trap for a particular error number but not now.
I want to trap for the failure of a SQL connection. Since there can be many reasons for failure I want to trap by the error number.
I found it during runtime in what looked like ex.innermessage.number but I cant get to it. How do I do it properly?
TIA.
VB Code:
'<CONNECT TO SQL DB> Try goSQLConn = New SqlConnection goSQLConn.ConnectionString = "Data Source=MyServer;Initial Catalog=MyDB;Integrated Security=SSPI;" goSQLConn.Open() Catch ex As Exception If ex.number = 4060 Then '<-- no dice :( End If End Try '</CONNECT TO SQL DB>






Reply With Quote