|
-
Apr 19th, 2007, 05:10 AM
#1
Thread Starter
Member
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!
-
Apr 19th, 2007, 05:24 AM
#2
Fanatic Member
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
-
Apr 19th, 2007, 06:18 AM
#3
Thread Starter
Member
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?
-
Apr 19th, 2007, 06:24 AM
#4
Fanatic Member
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
-
Apr 19th, 2007, 06:36 AM
#5
Thread Starter
Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|