用一TQuery控件,设计时就把sql语句写进去了,SQL如下:
select a.bmid,a.bmname,a.sumje,b.ldname,b.ldsr
from t_a a,t_b,cwdb:gz c
where a.bmid=b.bmid and a.bmid=c.bmid
  and a.bmxz="inner"
  and a.othflag[4]<>1
  and c.realgz=0
  and a.operatedate>=:opdate
  and a.startdate<=:stdate
其中要连接另外一个数据库cwdb的表gz,就用了cwdb:gz。
在设计时输入这段SQL给tquery控件后,其params里就有了gz、opdate、stdate这个参数,但是我本意并不是要将它作为参数,而是引用外部表也是用“库名:表名”这种形式。在运行时就提示语法错误。如果去除其中关于外部表的部分,运行没有问题。