Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cursoradapter
Message
De
06/05/2005 05:05:25
 
 
À
06/05/2005 04:08:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01011456
Message ID:
01011523
Vues:
14
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
>>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform