Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Connecting Oracle Db using ADO
Message
 
À
21/12/1999 03:41:17
Information générale
Forum:
Visual Basic
Catégorie:
Bases de données DAO/RDO/ODBC/ADO
Divers
Thread ID:
00306581
Message ID:
00306616
Vues:
17
>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)

This is all about CursorLocation.

With Access, it is always ClientSide.
With Oracle, it is ServerSise.

Change your code according to this:

Set oRs= New ADODB.Recordset
lcsql = "Select * from update_log "
oRs.CursorLocation = adUseClient
oRs.Open lcsqltest, oConn, adOpenStatic, adLockPessimistic
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform