General information
Category:
Coding, syntax & commands
What's the error message?
Try adding a property to the form for the recordset (and connection if necessary) and populate it during the Load() or Init(). Then specify the controlsource of the fields as Thisform.myRS.. etc. also make sure you refresh the controls when there is recordset activity.
HTH
>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
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only