简体   繁体   English

ADOTable.Locate在主从关系中

[英]ADOTable.Locate in Master-Detail Relationship

I have a Master-Detail Relationship between two Tables , I Select a Record in Master Table and its Details shows in Detail Table , next i want to Locate in Detail Table Only in Details about Master Table`s Selected Record but when I use ADOTable.Locate(...) , it locates in all Records of Detail Table ! 我在两个表之间有一个主从关系,我在主表中选择一条记录,其详细信息显示在明细表中,接下来我只想在主表的选定记录的详细信息中找到详细表,但是当我使用ADOTable时。查找(...),它位于明细表的所有记录中!
For Example I have this Tables : 例如我有这个表:

Master : 硕士:

ID | ID | Name 名称

11 | 11 | Mahmood 马哈茂德
22 | 22 | Maseoud 马苏乌德

.... ....

Detail : 详细说明:

UID | UID | Pet(!) 宠物(!)
11 | 11 | Cat
22 | 22 | Dog
22 | 22 | Cat

I have selected User "Mahmood" ( ID = 11) and in Detail Table only 1 Record shown with UID = 11 and Pet = Cat 我选择了用户“ Mahmood”(ID = 11),并且在详细信息表中仅选择了1条记录,其中UID = 11,Pet = Cat
Now I want to Locate on detail Table : 现在我要查找详细表:
DetailTable.Locate('Pet', 'Dog', []) DetailTable.Locate('宠物','狗',[])

"Locate" above returns " TRUE " whereas there is no Record with "Dog" value in details of Selected User 上面的“ Locate”返回“ TRUE”,而在“选定用户”的详细信息中没有“ Dog”值的记录

How can I solve this Problem ? 我怎么解决这个问题 ?
I want to Search in details of Selected Record in Master Table 我想在主表中搜索选定记录的详细信息

Thanks before ... 谢谢...

TCustomADODataSet.LocateRecord适用于未经过滤的克隆,请在搜索中指定所有相关字段:

DetailTable.Locate('UID; Pet', VarArrayOf([11, 'Dog']), [])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM