S
smallfox
Unregistered / Unconfirmed
GUEST, unregistred user!
我写了一个存储过程如下<br>CREATE PROCEDURE TC_TOTAL (<br> end_date date,<br> begin_date date)<br>as<br>declare variable gh varchar(10);<br>declare variable name varchar(20);<br>declare variable xm_name varchar(30);<br>declare variable js integer;<br>declare variable jzjs integer;<br>declare variable tchj float;<br>begin<br> delete from bb_tc;<br> for select "工号" from yg_info into :gh do<br> begin<br> select "姓名" from yg_info where "工号"=:gh into :name;<br> for select "项目名称" from val_fwxm into :xm_name do<br> begin<br> select sum("节数",sum("加钟节数",sum("提成合计"<br> from YW_TC where<br> ("本班日期" between :begin_date and :end_date)<br> and "项目名称"=:xm_name into :js, :jzjs, :tchj;<br> <br> insert into bb_tc ("开始日期","结束日期","工号","姓名","项目名称","节数","提成金额"<br> valuesbegin_date,:end_date,:gh,:name,:xm_name,:js+:jzjs, :tchj);<br><br> end<br> end<br>end^<br><br>现在我要在delphi中调用它提示出错<br><br> SqlStr:='execute procedure tc_total('+''''<br> +FormatDateTime('yyyy"-"mm"-"dd',RzDTPBeginDate.Date)+' 00:00:00'+''''<br> +','+''''+FormatDateTime('yyyy"-"mm"-"dd',RzDTPEndDate.Date)+' 23:59:59'+''''<br> +')';<br> ShowMessage(SqlStr);<br> FormDM.cdsTemp.Close;<br> FormDM.cdsTemp.CommandText:=SqlStr;<br> FormDM.cdsTemp.Execute;<br>请问该怎么处理?<br>我如果直接在IbConsol中执行<br>execute procedure tc_total('2007-1-1','2007-12-31')<br>计算出来全部为空值