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.
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 ENDFUNCBut 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