Hello All,
We are trying to use Oracle to collect measurement data and we are having trouble connecting to Oracle with Visual Basic Script. We get an error "invalid username and password". We think the syntax may not be totally correct - See below:
Sub Main()
Dim Cn As Object
Dim Conn As String
Dim QSQL As String
Dim rs As Object
Dim EMPNO As String
Dim EmpName As String
Dim EmpJob As String
EMPNO = "8110"
EmpName = "Smith"
EmpJob = "QA"
Set Cn = CreateObject("ADODB.Connection")
Cn.Open "Provider=OraOLEDB.Oracle;""Data Source=STHDEV.NET.SMITH.COM;""User Id=scott;""Password=tiger;"
Set rs=CreateObject("ADODB.RECORDSET")
rs.ActiveConnection = Conn
rs.CursorLocation = 3
rs.CursorType = 3
rs.LockType = 3
QSQL = "Insert Into EMP (EMPNO, ENAME, JOB) Values ('" & EMPNO & "','" & EmpName & "','" & EmpJob & "')"
rs.Open QSQL
'MsgBox "Done"
End Sub
Has anyone ever done this before or does anyone have any suggestions?
Thanks,
Jim
We are trying to use Oracle to collect measurement data and we are having trouble connecting to Oracle with Visual Basic Script. We get an error "invalid username and password". We think the syntax may not be totally correct - See below:
Sub Main()
Dim Cn As Object
Dim Conn As String
Dim QSQL As String
Dim rs As Object
Dim EMPNO As String
Dim EmpName As String
Dim EmpJob As String
EMPNO = "8110"
EmpName = "Smith"
EmpJob = "QA"
Set Cn = CreateObject("ADODB.Connection")
Cn.Open "Provider=OraOLEDB.Oracle;""Data Source=STHDEV.NET.SMITH.COM;""User Id=scott;""Password=tiger;"
Set rs=CreateObject("ADODB.RECORDSET")
rs.ActiveConnection = Conn
rs.CursorLocation = 3
rs.CursorType = 3
rs.LockType = 3
QSQL = "Insert Into EMP (EMPNO, ENAME, JOB) Values ('" & EMPNO & "','" & EmpName & "','" & EmpJob & "')"
rs.Open QSQL
'MsgBox "Done"
End Sub
Has anyone ever done this before or does anyone have any suggestions?
Thanks,
Jim
Comment