delphi三層數據感應問題 ( 积分: 100 )

  • 主题发起人 主题发起人 manzyj
  • 开始时间 开始时间
M

manzyj

Unregistered / Unconfirmed
GUEST, unregistred user!
各位大俠﹕
三層中client端我用socket方式連接﹐用clientDateSet下sql語句﹐如下﹕
SQLSTR:=' SELECT A.EQUIP_TYPE_NO,D.TYPE_DES,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'01'') as jan,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'02'') as feb,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'03'') as mar,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'04'') as APR,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'05'') as MAY,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'06'') as JUN,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'07'') as JUL,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'08'') as AUG,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'09'') as SEP,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'10'') as OCT,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'11'') as NOV,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'12'') as DEC '
+' FROM OUTPUT_SALES A,EQUIP_TYPE D WHERE A.EQUIP_TYPE_NO=D.TYPE_ID(+) and A.TYPE_NO=''A'' and a.division_no in ('+role_range_str+') GROUP BY A.EQUIP_TYPE_NO,D.TYPE_DES ORDER BY A.EQUIP_TYPE_NO';
可open以后﹐取不出數據﹐出現以下提示錯誤﹕”value of field is out of range“﹐請注意我的sql中sum這個函數
請指教﹐不勝感謝﹗我的mail是﹕manzyj@sina.com
 
各位大俠﹕
三層中client端我用socket方式連接﹐用clientDateSet下sql語句﹐如下﹕
SQLSTR:=' SELECT A.EQUIP_TYPE_NO,D.TYPE_DES,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'01'') as jan,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'02'') as feb,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'03'') as mar,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'04'') as APR,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'05'') as MAY,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'06'') as JUN,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'07'') as JUL,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'08'') as AUG,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'09'') as SEP,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'10'') as OCT,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'11'') as NOV,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'12'') as DEC '
+' FROM OUTPUT_SALES A,EQUIP_TYPE D WHERE A.EQUIP_TYPE_NO=D.TYPE_ID(+) and A.TYPE_NO=''A'' and a.division_no in ('+role_range_str+') GROUP BY A.EQUIP_TYPE_NO,D.TYPE_DES ORDER BY A.EQUIP_TYPE_NO';
可open以后﹐取不出數據﹐出現以下提示錯誤﹕”value of field is out of range“﹐請注意我的sql中sum這個函數
請指教﹐不勝感謝﹗我的mail是﹕manzyj@sina.com
 
跟踪一下,将实际的SQL语句取出到后台执行一下,看看能不能得到正确结果。
 
sql語句執行是沒有問題的。其實這種情況在兩層中執行也是沒有問題。 不知三層中為什么會出現這種情況。 各位大俠請盡快幫忙﹗
 
我认为应该是你的单行SQL语句超出规定的长度
建议在某些地方加上#13分隔一下。
 
同意楼上,sql长一些,会遇到不可预知的错误,很难跟踪,说有的不定都打,可能会好点,
我遇到的情况,ado2。5有这样问题,换ado2。6就没有,软件一点也没改。
 
各位兄弟﹕
其實我開始也懷疑是sql過長的問題﹐后來改成較短的sql﹐結果也出現同樣的錯誤。現在問題很明顯﹕就是在三層中﹐client端不能從具有sum(),count()等計算的sql中取出數據。諸位請幫忙考慮﹗
 
[red][/red]樓主﹐趕快幫忙啊!
 
后退
顶部