Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
User Defined Get Functions on why this format
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COMCodebook
Divers
Thread ID:
00728697
Message ID:
00728718
Vues:
13
This message has been marked as a message which has helped to the initial question of the thread.
I think that the main reason they are using parameters that it's more generic approch and doesn't required converting parameters into string to build SQL.

What VFP OLE DB provider are you using? Try one from VFP8beta.

>>Your version wouldn't work w/o correction
lcSql = [SELECT User.* FROM User WHERE Usrname LIKE '] + tuUsrname + [']
It explicitly uses single quote as string literal delimiter which may or may not work with all backends.
>
>
>So what you are saying is the PARAMETERS.APPEND is used because it is more compatible with a variety of backends (VFP, Oracle, SQL)?
>
>What I have found is that using a VFP backend and OLEDB the PARAMETERS.APPEND does not work with an Integer Parameter. The COMCodeBook example uses:
>
>
>  FUNCTION GetUserByUsrkey( tuUsrkey )
>    *-----------------------------------------------------
>    LOCAL loADO, lcSql
>    loADO = THIS.GetADOAggregateParameter()
>    WITH loADO.oCommand
>      .ActiveConnection = loADO.oConnection
>
>      ***********************************
>      .CommandText = [SELECT User.* FROM User WHERE UsrKey = ? ]
>
>      *-- CONSTRUCT YOUR PARAMETER(S)
>      .PARAMETERS.APPEND(.CreateParameter( "UsrKey", adInteger, adParamInput, ,tuUsrkey ))
>      ***********************************
>    ENDWITH
>
>    THIS.ExecuteSQLQuery( loADO )
>    RETURN loADO.oRecordSet
>
>  ENDFUNC
>

>But using OleDb the great error:

>Error in USER::GETUSERBYUSRKEY() Line 85
>Error Number: 1429
>
>1429
>OLE IDispatch exception code 1429 from UserDataSource: ~Error: 1429 Line: 129 UserDataSource::Executesqlquery() OLE IDispatch exception code 0 from Microsoft OLE DB Provider for Visual FoxPro: Index does not accept NULL.....
>~Error: 1429 Line: 129 UserDataSource::Executesqlquery() OLE IDispatch exception code 0 from Microsoft OLE DB Provider for Visual FoxPro: Index does not accept NULL...
>UserDataSource
>UserDataSource
>0
>1429
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform