Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursoradapter
Message
From
06/05/2005 05:05:25
 
 
To
06/05/2005 04:08:00
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01011456
Message ID:
01011523
Views:
13
Hi Gaylen.

The diference there is that ThisForm.lnPolicy isn't in scope, because during the CursorFill it's in the scope of the CursorAdapter, not the method on the form that you are doing the fill from.

Ian Simcock.


>Simplcio - Thanks I think what you provided was how Doug Henning does it in his white paper on cursoradapters.
>
>However in the simple example I gave the variable lnpolicy works if you populate it before cursorfill().
>
>
>selectCmd = "Select * from policy where policy = ?lnpolicy
>
>
>
>However using a form property "thisform.lnpolicy" brings up a prompt box in which the user has to add the policy number.
>
>
>selectCmd = "Select * from policy where policy = ?thisform.lnpolicy
>
>
>Why the difference? Both the property and variable are in scope and were assigned before the cursorfill()
>
>Gaylen
>
>
>
>
>
>
>
>>
>>* .ConnectionString = 'provider=SQLOLEDB.1;data source=localhost;' + ;
>>* 'initial catalog=Northwind;trusted_connection=yes'
>>CLEAR
>>LOCAL loConn AS ADODB.CONNECTION, ;
>>   loCommand AS ADODB.COMMAND, ;
>>   loParam AS ADODB.PARAMETER, ;
>>   loRs AS ADODB.Recordset,;
>>   loException AS EXCEPTION, ;
>>   loCursor AS CURSORADAPTER, ;
>>   lcCountry, ;
>>   laErrors[1]
>>loConn = CREATEOBJECT('ADODB.Connection')
>>WITH loConn
>>   .ConnectionString = 'provider=vfpoledb;data source=' + ;
>>      HOME(2)+'northwind\Northwind.dbc'
>>   TRY
>>      .OPEN()
>>   CATCH TO loException
>>      MESSAGEBOX(loException.MESSAGE)
>>      CANCEL
>>   ENDTRY
>>ENDWITH
>>loCommand = CREATEOBJECT('ADODB.Command')
>>loCommand.CommandText = ;
>>   "SELECT * FROM customers WHERE Country = ?"
>>loParam = loCommand.CreateParameter("Country", 129, 1, 15, "")
>>loCommand.PARAMETERS.APPEND(loParam)
>>loCommand.PARAMETERS("Country") = "Brazil"
>>loCommand.ActiveConnection = loConn
>>loRs = loCommand.Execute()
>>loCursor = CREATEOBJECT('CursorAdapter')
>>WITH loCursor
>>   .ALIAS          = 'Customers'
>>   .DATASOURCETYPE = 'ADO'
>>   llReturn = .CURSORFILL(.F., .F., 0, loRs)
>>   IF llReturn
>>      BROWSE
>>   ELSE
>>      AERROR(laErrors)
>>      MESSAGEBOX(laErrors[2])
>>   ENDIF llReturn
>>ENDWITH
>>
Previous
Reply
Map
View

Click here to load this message in the networking platform