Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ADO Tips
Message
De
29/05/1998 14:58:53
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Titre:
Divers
Thread ID:
00103147
Message ID:
00103203
Vues:
23
Hi John,

Thanks for the info and like the others here would like as much as I can get on using ADO. I caught a couple of your sessions at DevCon ( including ADO ). Good Stuff.

Thanks,
Bill


>Hi Gang,
>
>In response to the interest folks have regarding ADO, I am going to periodcially post tips on how to use ADO. Keep in mind that my stuff is predicated on ADO 2.0 - which is available from the VI 6 CD. ADO will ship in the VFP 6 Box - as well as Visual Studio. If you don't have ADO 2 yet - just park this stuff off until you get it.
>
>Here is the first one:
>
>Hi Gang,
>
>A nice thing about ADO, and opening recordsets, is that you don't always
>need SQL. Just as you can refer to just the table name in VFP, so too can
>you do the same thing in ADO. The code below opens up the SQL Server Pubs
>database via a DSN called pubs. Unfortunately, the VFP ODBC driver cannot
>do the same thing. You still need to use SQL. But, if you are using
>SQL/Server or some other back-end, this syntax should work:
>
>*---- CursorTypeEnum Values ----
>#DEFINE ADOPENFORWARDONLY 0
>#DEFINE ADOPENKEYSET 1
>#DEFINE ADOPENDYNAMIC 2
>#DEFINE ADOPENSTATIC 3
>
>*---- LockTypeEnum Values ----
>#DEFINE ADLOCKREADONLY 1
>#DEFINE ADLOCKPESSIMISTIC 2
>#DEFINE ADLOCKOPTIMISTIC 3
>#DEFINE ADLOCKBATCHOPTIMISTIC 4
>
>*---- CursorLocationEnum Values ----
>#DEFINE ADUSESERVER 2
>#DEFINE ADUSECLIENT 3
>
>
>oConnection = CreateObject("adodb.connection")
>oRecordSet = CreateObject("adodb.recordset")
>
>With oRecordSet
> .CursorLocation = adUseClient
> .CursorType = adOpenStatic
> .LockType = adLockBatchOptimistic
>EndWith
>
>oConnection.Open("pubs","sa","")
>oRecordSet.Open("authors",oconnection,3,4) && no sql, just refer to the
>table name
>
>Do While !oRecordSet.Eof
> ?oRecordSet.Fields("au_lname").Value
> oRecordSet.MoveNext
>EndDo
William A. Caton III
Software Engineer
MAXIMUS
Atlanta, Ga.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform