G
Guest
I have written the following function which returns OleDbConnection object.
If global variable g_strDbPath contains an invalid file name or path name the
catch block throws an error with appropriate error message, but if
g_strDbPath is blank then the catch block throws an error saying “No error
information available: DB_SEC_E_AUTH_FAILED(0x80040E4D).†In this case
connection string is incorrect so why doesn’t it throws as appropriate error
message?
Public Function CreateConnection() As OleDbConnection
Try
Dim cnn As OleDbConnection
Dim strCnn As String
strCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
& g_strDbPath
'! Initialize connection object.
cnn = New OleDbConnection(strCnn)
Return cnn
Catch ex As Exception
Throw ex
End Try
End Function
If global variable g_strDbPath contains an invalid file name or path name the
catch block throws an error with appropriate error message, but if
g_strDbPath is blank then the catch block throws an error saying “No error
information available: DB_SEC_E_AUTH_FAILED(0x80040E4D).†In this case
connection string is incorrect so why doesn’t it throws as appropriate error
message?
Public Function CreateConnection() As OleDbConnection
Try
Dim cnn As OleDbConnection
Dim strCnn As String
strCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
& g_strDbPath
'! Initialize connection object.
cnn = New OleDbConnection(strCnn)
Return cnn
Catch ex As Exception
Throw ex
End Try
End Function