你找一个key不久可以了。locate支持多个字段联合定位。 贴一段delphi的描述及示例: Call Locate to search a dataset for a specific row and make it the current row.KeyFields is a string containing a semicolon-delimited list of field names on which to search.KeyValues is a variant that specifies the values to match in the key fields. If KeyFields lists a single field, KeyValues specifies the value for that field on the desired row. To specify multiple search values, pass a variant array as KeyValues, or construct a variant array on the fly using the VarArrayOf routine. For example:with ADOTable1 do Locate('Company;Contact;Phone', VarArrayOf(['Sight Diver', 'P', '408-431-1000']), [loPartialKey]);
你的“查看”字段必须具有唯一性才可以,否则无法定位。
贴一段delphi的描述及示例:
Call Locate to search a dataset for a specific row and make it the current row.KeyFields is a string containing a semicolon-delimited list of field names on which to search.KeyValues is a variant that specifies the values to match in the key fields. If KeyFields lists a single field, KeyValues specifies the value for that field on the desired row. To specify multiple search values, pass a variant array as KeyValues, or construct a variant array on the fly using the VarArrayOf routine. For example:with ADOTable1 do
Locate('Company;Contact;Phone', VarArrayOf(['Sight Diver', 'P', '408-431-1000']), [loPartialKey]);
楼主有时间,应该多跟踪跟踪Delphi源代码
就好比有10棵白菜(10棵带都带,或者是一部分带,一部分不带),你要那棵带根的。请问你要选择哪棵?
有的时候,你不必局限非得要某种方法来达到,你可以把问题放大,换一种方法,思路。
达到你要的目的!