BMD4
07-07-2018, 10:51 AM
Hi,
I have created ODBC connection and trying to test ODBC connection in excel through VB.
ODBC DSN is tested and working.But when I use same DSN in VB script, it says invalid user name/password error.
Can any on let me know what is missing here.
Sub OraConn()
'Dim cnn As ADODB.Connection
'Set cnn = New ADODB.Connection
'Open a Connection using an ODBC DSN
Dim cnn As Object
Set cnn = CreateObject("ADODB.Connection")
cnn.Open "D_DSN", "ro_user", "xxxx"
If cnn.State = adStateOpen Then
MsgBox "Welcome"
Else
MsgBox "Sorry."
End If
' Close the connection.
cnn.Close
End Sub
Thanks in advance
I have created ODBC connection and trying to test ODBC connection in excel through VB.
ODBC DSN is tested and working.But when I use same DSN in VB script, it says invalid user name/password error.
Can any on let me know what is missing here.
Sub OraConn()
'Dim cnn As ADODB.Connection
'Set cnn = New ADODB.Connection
'Open a Connection using an ODBC DSN
Dim cnn As Object
Set cnn = CreateObject("ADODB.Connection")
cnn.Open "D_DSN", "ro_user", "xxxx"
If cnn.State = adStateOpen Then
MsgBox "Welcome"
Else
MsgBox "Sorry."
End If
' Close the connection.
cnn.Close
End Sub
Thanks in advance