Information générale
Catégorie:
Bases de données DAO/RDO/ODBC/ADO
Titre:
Connecting Oracle Db using ADO
I 'm having Problem while connecting Oracle Db using ADO.
When I was Created The Recordset ,I cannot find the record Count.
The record Count shows -1.But I can do addnew etc.. The Same Command line I used in MSAccess DB It's Fine.I know if the cursor types
are openDynamic or openforward ,the record Count return as -1.
But other cursor Type also showing the record Count is -1.while connecting oracleDb
The Code As Follows:
Oracle Db
----------
Dim oConn as adodb.connection
Dim oRs as adodb.recordset
Set oConn = New ADODB.Connection
oConn.ConnectionString = "DSN=MyDsn;UID=abc;Pwd=abc"
oConn.Open
Set oRs= New ADODB.Recordset
lcsql = "Select * from update_log "
oRs.Open lcsqltest, oConn, adOpenStatic, adLockPessimistic
(Debug.print ors.recordcount)
x=ors.recordcount
* Actuall there are 25 records in the table
Using Acces Db
---------------
Dim oConn1 As ADODB.Connection
Dim ors1 As ADODB.Recordset
Set oConn1 = New ADODB.Connection
Set ors1 = New ADODB.Recordset
oConn1.ConnectionString = "DSN=Barcoderep"
oConn1.Open
LCSQL1 = "SELECT * FROM Item"
Set ors1 = New ADODB.Recordset
ors1.Open LCSQL1, oConn1, adOpenStatic, adLockPessimistic
a = ors1.RecordCount(Here I can see the record count)
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement