比如使用AdoQuery
select * from tDetail
where aaa=:MasterID
and bbb=:MasterID
然后通过tDetail的DataSource连接到dsMaster。
但是我Detail控件里面收不到数据。
怎么办?
select * from tDetail
where aaa=:MasterID
and bbb=:MasterID
然后通过tDetail的DataSource连接到dsMaster。
但是我Detail控件里面收不到数据。
怎么办?
MasterID :='55';
AdoQuery.close;
AdoQuery.sql.clear;
AdoQuery.sql.add(
select * from tDetail
where aaa='+QuotedStr(MasterID)+'
and bbb='+QuotedStr(MasterID));
AdoQuery.open
把你的SQL语句改成这样就OK啦
大家可以肯定的是
select * from tblMaster // Master
select * from tblDetail where tblDetail.MasterID=:MasterID//Detail
然后设置一下adoDetail.DataSource就实现了
Master变,Detail也变。
当然,如果多几个参数变量,也是可以实现的。
问题是,如果多几个是一样的,都是MasterID怎么办?
有没有谁碰到过?
分不够可以加。
where aaa=:MasterID
and bbb=aaa这个答案偏题了,不是我想知道的。
不知道你要求的功能是什么。。 select * from tDetail
where aaa=:MasterID
and bbb=aaa这样确实可以。。= =!帮你顶
adoquery1.Parameters.ParamByName('pe').Value := l1.Caption;
adoquery1.close;
adoquery1.Open;这样不行?
adoquery1.Parameters.ParamByName('pe').Value := Matabelid;
adoquery1.close;
adoquery1.Open;
放到 dsMaster 的 DataSource 的 ondatachenage 里