Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ADO and VFP6 (updated with SP5)
Message
De
25/11/2002 14:32:23
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
ADO and VFP6 (updated with SP5)
Divers
Thread ID:
00726605
Message ID:
00726605
Vues:
48
Anyone able to help?

I have VFP6 (SP5). I am trying to use ADO programmatically. The connection that I have created works fine. I have managed to connect. However, I am having problems using the Recordset object; i.e., passing the data to object on a form.

I seem to think it is impossible to use the USE IN statement. If this is not so, how do I?

The code I have used is as follows:

&&local variables
Local oConnection, lcConnectionString, oRecordSet, lsSavedRecordSetLocation


&&create the ADO objects
&&--------------------------------
oConnection = Createobject("adodb.connection")
oRecordSet = CreateObject("adodb.recordset")

&&connection details
&&-------------------------
oConnection.CursorLocation = adUseClient
lcConnectionString = "Provider=MSDASQL.1;" +
"Password=scotland;" +
"Persist Security Info=True;" +
"User ID=sue;" +
"Data Source=SQLHomeInfo;" +
"Mode=ReadWrite;" +
"Initial Catalog=HomeInfo"
oConnection.Open = lcConnectionString


&&recordset settings
&&-----------------------
With oRecordSet
.LockType = adLockbatch
.CursorType = adopenstatic
.ActiveConnection = oConnection
.Open('Select * from stock')
.ActiveConnection = Null
Endwith


*lsSavedRecordSetLocation = (HOME(2) + 'data/shopper.rs')

*oRecordSet.Save("c:\data manager\data\shopper.rs")

*WAIT WINDOW "Data stored to the hard drive" + CHR(13) + "" + CHR(13) && WAIT

*release oconn

*0RecordSet.Open("c:\data manager\data\shopper.rs",,3,3)




*if not(err) then &&ADO is not installed
*WAIT WINDOW "ADO is installed" + CHR(13) + "" + CHR(13) && WAIT
*endif


&&putting the data into object on a form
&&---------------------------------
RemoteShopper.My_shopper_editor1.my_pcode1.controlsource = oRecordSet.Fields("pcode").value
** more fields filled with data - code left out **

frmMyForm.SHOW && Display the form

Read EVENTS && Start event processing
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform