Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
User Defined Get Functions on why this format
Message
General information
Forum:
Visual FoxPro
Category:
COMCodebook
Miscellaneous
Thread ID:
00728697
Message ID:
00728708
Views:
22
>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
Bret Hobbs

"We'd have been called juvenile delinquents only our neighborhood couldn't afford a sociologist." Bob Hope
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform