Menu

Returning collection of Objects

2004-07-28
2013-03-07
  • Anurag Jamloki

    Anurag Jamloki - 2004-07-28

    I have an object Account that is mapped to Account_Table in the database. Can you please show me how I can get a collection of Account objects from the database given "where Account.NAME like 'Acc%' "

     
    • Richard Banks

      Richard Banks - 2004-07-28

      The following should work

      dim rc as new CRetrieveCriteria
      dim acc as new Account

      rc.ClassMap = acc.getClassMap()
      rc.WhereCondition.addSelectLike("NAME","Acc%")
      dim cc as CCursor = rc.perform()
      while not cc.EOF
        acc = new Account
        cc.loadObject(acc)
        debug.writeline(acc.NAME)
        cc.NextCursor()
      end while

       
    • André Ribeiro

      André Ribeiro - 2004-11-03

      But how can I use this criteria without code? Because I'm using in a form and when I click at the button "Search"  the code instances a Object and pass to the method find with the character %.

      Thanks,
      Andr Ribeiro

       
      • Richard Banks

        Richard Banks - 2004-11-03

        Add a method to your object that wraps this functionality, and allows you to pass the search value as a parameter.

        You may want to make it a static/shared method so that you don't have to instantiate the object first.

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.