C
chjer
Unregistered / Unconfirmed
GUEST, unregistred user!
今天在写一个报表程序时,发现在三层结构中只要用子查询就出错,请各位大吓出招,
服务端用ADO:
adsGeneral.CommandText:='select t_item,t_dsca,t_kost,t_koor,t_recd,(t_quan) from '
+'(select a.t_item,a.t_cwar,a.t_kost,'
+'a.t_koor,a.t_quan,b.t_recd,c.t_dsca from ttdinv700200 as a,'
+'ttdinv100200 as b,ttiitm001100 as c where a.t_orno*=b.t_wrho and '
+'a.t_item=c.t_item and '
+'a.t_cwar='+''''+ck+''''+' and c.t_citg='+''''+wlz+''''+' and a.t_trdt>='
+''''+startdate+''''+' and a.t_trdt<='+''''+enddate+''''+') as aa';
打开时出错提示:数据提供者或其他服务返回E_FAIL状态
将CommandText改成不含子查询的语句一切正常
我用Profiler监测数据库服务该语句已执行成功
服务端用ADO:
adsGeneral.CommandText:='select t_item,t_dsca,t_kost,t_koor,t_recd,(t_quan) from '
+'(select a.t_item,a.t_cwar,a.t_kost,'
+'a.t_koor,a.t_quan,b.t_recd,c.t_dsca from ttdinv700200 as a,'
+'ttdinv100200 as b,ttiitm001100 as c where a.t_orno*=b.t_wrho and '
+'a.t_item=c.t_item and '
+'a.t_cwar='+''''+ck+''''+' and c.t_citg='+''''+wlz+''''+' and a.t_trdt>='
+''''+startdate+''''+' and a.t_trdt<='+''''+enddate+''''+') as aa';
打开时出错提示:数据提供者或其他服务返回E_FAIL状态
将CommandText改成不含子查询的语句一切正常
我用Profiler监测数据库服务该语句已执行成功