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
Title:
User Defined Get Functions on why this format
Miscellaneous
Thread ID:
00728697
Message ID:
00728697
Views:
44
COMCodeBook uses this format for a user defined Get Function:
  FUNCTION GetUserByUsrname( tuUsrname )
    *-----------------------------------------------------
    LOCAL loADO
    loADO = THIS.GetADOAggregateParameter()
    WITH loADO.oCommand
      .ActiveConnection = loADO.oConnection

      ***********************************
      *----------------------------------
      .CommandText = [ SELECT User.* FROM User WHERE Usrname LIKE ? ]
      .PARAMETERS.APPEND(.CreateParameter( "Usrname", adChar, adParamInput, 18 ,tuUsrname ))
      ***********************************
    ENDWITH

    THIS.ExecuteSQLQuery( loADO )
    RETURN loADO.oRecordSet

  ENDFUNC
Why is the above more valuable than just doing:
  FUNCTION GetUserByUsrname( tuUsrname )
    *-----------------------------------------------------
    LOCAL loADO, lcSql
    loADO = THIS.GetADOAggregateParameter()
    WITH loADO.oCommand
      .ActiveConnection = loADO.oConnection

      lcSql = 'SELECT User.* FROM User WHERE Usrname LIKE ' + tuUsrname 
      .CommandText = lcSql
    ENDWITH

    THIS.ExecuteSQLQuery( loADO )
    RETURN loADO.oRecordSet

  ENDFUNC
Bret Hobbs

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

Click here to load this message in the networking platform