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!
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:
for each row in rowCollection
if PK1 = param1 and PK2 = param2 then 'my work here
next
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?
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
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!