Results 1 to 5 of 5

Thread: Databinding.find multiple fields

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2003
    Posts
    38

    Databinding.find multiple fields

    Hi all!

    I'm with a problem wich is really twisting my mind.

    I've a databinding to a grid, and i use the databinding.find method to search records. The big problem is that my primarykey is made of two fields, NumeroTratamento and NumLinha, and i cant figure how to search with the find method two fields at the same time.

    Thanks in advance!

  2. #2
    Fanatic Member
    Join Date
    Feb 2007
    Location
    Eindhoven
    Posts
    828

    Re: Databinding.find multiple fields

    Normaly a table has only one primary key which can be sear using the find method of the databinding. In your case, I suggest that you write your own routine to retrive the recodrs you are looking for
    vb Code:
    1. for each row in rowCollection
    2.   if PK1 = param1 and PK2 = param2 then 'my work here
    3. next

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2003
    Posts
    38

    Re: Databinding.find multiple fields

    Thanks talkro for the alternative!

    So, there's really no other way the find method find two fields at the same time?

  4. #4
    Fanatic Member
    Join Date
    Feb 2007
    Location
    Eindhoven
    Posts
    828

    Re: Databinding.find multiple fields

    I've never used i that way. I know that when you create an adapter at design table on a table that have no PK or multiple PKs, the Insert, Delete and Update query are not dynamically created because the underneath process doesn't know on what criteria thoseare based. So I assume that is is the same with the find method

  5. #5

    Thread Starter
    Member
    Join Date
    Dec 2003
    Posts
    38

    Re: Databinding.find multiple fields

    hmmm i only think it's kinda weird, because in the past VB allowed us to define a composed PK, and pass an array of parameters to find a record. With the evolution of the language, i thought it was supposed the language helped us even more.

    The solution you showed... it works, and solves the problem, but its like openning a table and increment a counter till EOF of it when you can just use the .rows.Count method instead!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width