Hello,
I have the following code:
Sub MySub()
Dim ADORst as ADODB.Recordset, strCn as string
DimCnLive as ADODB.Connection, cmdADO as ADODB.Command
Set ADORSt = New ADODB.Recordset
Set CnLive = New ADODB.Connection
strCn="DSN=MyDSN; UID=MyID; PWD=MyPwd; " & _
"DBQ=MyDb; DBQ=W; APA=T; PFC=1; TLO=0"
CnLive.ConnectionTimeout=0
Set cmdADO=New ADODB.Command
strSQL="select * from myTable_in_oracle;"
cmdADO.CommandText=strSQL
With ADORst
.CursorType=adOpenStatic
.LockType=adLockPessimistic
.ActiveConnection=CnLive
End With
ADORst.Open cmdADO.CommandText
call
End Sub
==============================================
Sub MyNextSub(ADORst as ADODB.Recordset)
ADORst.MoveFirst
'more code...
End Sub
I'm new to ADO, and all this is kind of freakin' me out, but the first procedure seems to work with pretty good efficiency. The only thing I have problems with is in the next procedure, I pass the ADORst object, and do an ADORst.MoveFirst on it. The MoveFirst takes FOREVER. Not only that, but if the server is already being hit by a lot of activity when my code reaches the "MoveFirst" part, the ODBC driver times out, and I get an error message. I don't know what the deal is with respect to why an ADO recordset requires so many resources just to move to the first recordset, do you have any suggestions?
Also, I believe it is true that when the ADO recordset opens, it defaults to the first record. Is this correct?
Thanking you in advance for your help.
-Mike
I have the following code:
Sub MySub()
Dim ADORst as ADODB.Recordset, strCn as string
DimCnLive as ADODB.Connection, cmdADO as ADODB.Command
Set ADORSt = New ADODB.Recordset
Set CnLive = New ADODB.Connection
strCn="DSN=MyDSN; UID=MyID; PWD=MyPwd; " & _
"DBQ=MyDb; DBQ=W; APA=T; PFC=1; TLO=0"
CnLive.ConnectionTimeout=0
Set cmdADO=New ADODB.Command
strSQL="select * from myTable_in_oracle;"
cmdADO.CommandText=strSQL
With ADORst
.CursorType=adOpenStatic
.LockType=adLockPessimistic
.ActiveConnection=CnLive
End With
ADORst.Open cmdADO.CommandText
call
End Sub
==============================================
Sub MyNextSub(ADORst as ADODB.Recordset)
ADORst.MoveFirst
'more code...
End Sub
I'm new to ADO, and all this is kind of freakin' me out, but the first procedure seems to work with pretty good efficiency. The only thing I have problems with is in the next procedure, I pass the ADORst object, and do an ADORst.MoveFirst on it. The MoveFirst takes FOREVER. Not only that, but if the server is already being hit by a lot of activity when my code reaches the "MoveFirst" part, the ODBC driver times out, and I get an error message. I don't know what the deal is with respect to why an ADO recordset requires so many resources just to move to the first recordset, do you have any suggestions?
Also, I believe it is true that when the ADO recordset opens, it defaults to the first record. Is this correct?
Thanking you in advance for your help.
-Mike