vmandem
asked on
AN ADO ERROR IN VISUALBASIC
I got a connection string with ADO. It works fine on my
machin and when i made an executable of my programme and
run the executable on other machine it gives me typemismatch error. I put messaboxes everwhere in my
connection and found it is doing at an initialization of
recordset. Below is the code i m using to connect.
---->
Dim Conn As ADODB.Connection
Dim RS As ADOR.Recordset
Dim AdoCmd As ADODB.Command
Dim ConnString As String
Dim ORCLServerConnect As String
Set Conn = CreateObject("ADODB.Connec tion")
Set RS = CreateObject("ADOR.Records et")
ORCLServerConnect = "driver={Microsoft ODBC for Oracle};" & _
"server=" & Me.ServerName & ";" & _
"PWD=" & g_sPassword & ";" & _
"UID=" & g_sUserName & ";"
RS.ActiveConnection = ORCLServerConnect
'----->
It gives me error at:
Set RS = CreateObject("ADOR.Records et")
It works fine on my machine, even the executable runs fine on my machine. It gives typemismacth on a different machine.
I checked the dll's, registration everything is same and perfect.
VM
machin and when i made an executable of my programme and
run the executable on other machine it gives me typemismatch error. I put messaboxes everwhere in my
connection and found it is doing at an initialization of
recordset. Below is the code i m using to connect.
---->
Dim Conn As ADODB.Connection
Dim RS As ADOR.Recordset
Dim AdoCmd As ADODB.Command
Dim ConnString As String
Dim ORCLServerConnect As String
Set Conn = CreateObject("ADODB.Connec
Set RS = CreateObject("ADOR.Records
ORCLServerConnect = "driver={Microsoft ODBC for Oracle};" & _
"server=" & Me.ServerName & ";" & _
"PWD=" & g_sPassword & ";" & _
"UID=" & g_sUserName & ";"
RS.ActiveConnection = ORCLServerConnect
'----->
It gives me error at:
Set RS = CreateObject("ADOR.Records
It works fine on my machine, even the executable runs fine on my machine. It gives typemismacth on a different machine.
I checked the dll's, registration everything is same and perfect.
VM
I am with rkot.
Besides, try to change:
Set RS = CreateObject("ADOR.Records et")
to
Set RS = new ADOR.Recordset
(same to others CreateObject)
since CreateObject is used if you don't use strong typed variables (dim RS As Object).
Besides, try to change:
Set RS = CreateObject("ADOR.Records
to
Set RS = new ADOR.Recordset
(same to others CreateObject)
since CreateObject is used if you don't use strong typed variables (dim RS As Object).
You can pass the ActiveConnection property when you open RS
RS.open "sqlstatement",conn
RS.open "sqlstatement",conn
something like:
Private Sub Form_Load()
Dim Conn As ADODB.Connection
Dim RS As ADOR.Recordset
Dim AdoCmd As ADODB.Command
Dim ConnString As String
ConnString = "Provider=Microsoft.Jet.OL EDB.4.0;Da ta Source=C:\FMC\Register\cen tros.mdb;P ersist Security Info=False;Jet OLEDB:Database Password=xxxx"
Set Conn = New ADODB.Connection
Set RS = New ADOR.Recordset
With Conn
.ConnectionString = ConnString
.Open
If .State = adStateOpen Then
RS.Open "select * from centros order by cod_centro", Conn, adOpenDynamic, adLockOptimistic
End If
End With
Do While Not RS.EOF
Debug.Print RS.Fields(0)
RS.MoveNext
Loop
End Sub
Private Sub Form_Load()
Dim Conn As ADODB.Connection
Dim RS As ADOR.Recordset
Dim AdoCmd As ADODB.Command
Dim ConnString As String
ConnString = "Provider=Microsoft.Jet.OL
Set Conn = New ADODB.Connection
Set RS = New ADOR.Recordset
With Conn
.ConnectionString = ConnString
.Open
If .State = adStateOpen Then
RS.Open "select * from centros order by cod_centro", Conn, adOpenDynamic, adLockOptimistic
End If
End With
Do While Not RS.EOF
Debug.Print RS.Fields(0)
RS.MoveNext
Loop
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
usually i using ado with oledb provider.
Dim Conn As ADODB.Connection
Dim RS As ADODB.Recordset
Dim AdoCmd As ADODB.Command
Dim ConnString As String
Dim ORCLServerConnect As String
Set Conn = new ADODB.Connection
Set RS = new ADODB.Recordset
conn.open "Provider=OraOLEDB.Oracle; " & _
"Data Source=" & ServerName & ";" & _
"User Id=myUsername;" & _
"Password=myPassword;"
sql5 = "............."
with rs
.cursorlocation = aduseserver
.open sql5, conn, adOpenDynamic, adLockOptimistic
end with
another url to learn oledb connections using oracle.
http://download-west.oracle.com/otndoc/oracle9i/901_doc/win.901/a90171/using.htm
cheers!
Dim Conn As ADODB.Connection
Dim RS As ADODB.Recordset
Dim AdoCmd As ADODB.Command
Dim ConnString As String
Dim ORCLServerConnect As String
Set Conn = new ADODB.Connection
Set RS = new ADODB.Recordset
conn.open "Provider=OraOLEDB.Oracle;
"Data Source=" & ServerName & ";" & _
"User Id=myUsername;" & _
"Password=myPassword;"
sql5 = "............."
with rs
.cursorlocation = aduseserver
.open sql5, conn, adOpenDynamic, adLockOptimistic
end with
another url to learn oledb connections using oracle.
http://download-west.oracle.com/otndoc/oracle9i/901_doc/win.901/a90171/using.htm
cheers!
spiral, waht is the idea to post a comment that is so similar to previous one?
ASKER
I will try and let you know guys. I appreciate your comments.
VM
VM
ASKER
Richie,acperkins
I get the following error after using the early binding technique:
Login Error: 430 , Class doesn't support Automation at
Set RS = New ADOR.Recordset
I didnot find any usefull help from MSDN or anywhere.
What is the alternative.
As I said it works fine on my machine and compiled successfully and made .exe file, no problem running the
.exe file on my machine but give the above error in a different machine.
So which is appropriate to use like the early binding or latebinding.
VM
I get the following error after using the early binding technique:
Login Error: 430 , Class doesn't support Automation at
Set RS = New ADOR.Recordset
I didnot find any usefull help from MSDN or anywhere.
What is the alternative.
As I said it works fine on my machine and compiled successfully and made .exe file, no problem running the
.exe file on my machine but give the above error in a different machine.
So which is appropriate to use like the early binding or latebinding.
VM
well, use adodb as ac saids and not ador and try.
Give reference of MS object Library 2.0 and Use Adodb instead of Ador
ASKER
VBMEERA
Eventhough you are absoultly right, i have to give points
to acperkins, since i got the answer from him. There is
nothing not to accept your answer. I hope you understand
the suituation.
VM
Eventhough you are absoultly right, i have to give points
to acperkins, since i got the answer from him. There is
nothing not to accept your answer. I hope you understand
the suituation.
VM
ASKER
acperkins
I really appreciate your answer.
I really appreciate richie simonetti's answer.
I really appreciate everybody's comments. I really thank
everyone for there support and hope continue the same
VM
I really appreciate your answer.
I really appreciate richie simonetti's answer.
I really appreciate everybody's comments. I really thank
everyone for there support and hope continue the same
VM
:O
Richie,
Te debo una. <g>
Anthony
Te debo una. <g>
Anthony
Bueno....(grrrrrrrrr!!!!!) , viste el top 15?
Que jugador!!! ....:))))))))
Que jugador!!! ....:))))))))
Richie,
#14: Congratulations! Give me about 5 years and I will catch up with you.
Anthony
#14: Congratulations! Give me about 5 years and I will catch up with you.
Anthony
if you didn't beat me here, maybe i would be at 13! I am not so good with db stuff (i hate it, really)
try to run mdac_ setup an clients pc.