请教cxgrid设置多个主从表的问题?
-
米果 2009-03-11 22:26
我用CXgrid做主从表,想要做成Level1下建立Level2,Level2下建立Level3,每个Level有建立一个DBTable,使ADOQuery连接,下面是ONSHOW窗体后的代码,各个DBTable的关键字都是Code字段,Level1的DBTable和Level2的DBTable字段Code是一对一关系,Level2的DBTable和Level3的DBTable字段Code是一对多关系。
我设置好后,Level1和Level2显示正常,Level3没有数据,我检查了一下数据源连接都没有问题,请教高手这是为什么?
self.ADOQuery1.Active :=false;
self.ADOQuery1.Active :=true;
self.ADOQuery2.Active :=false;
self.ADOQuery2.Active :=true;
self.ADOQuery3.Active :=false;
self.ADOQuery3.Active :=true;
cxGrid1DBTableView1.DataController.KeyFieldNames := 'Code';
cxGrid1DBTableView2.DataController.MasterKeyFieldNames := 'Code';
cxGrid1DBTableView2.DataController.DetailKeyFieldNames := 'Code';
cxGrid1DBTableView2.DataController.KeyFieldNames := 'Code';
cxGrid1DBTableView3.DataController.MasterKeyFieldNames := 'Code';
cxGrid1DBTableView3.DataController.DetailKeyFieldNames := 'Code';