首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

delphi7调用存储过程失败。解决思路

2012-03-23 
delphi7调用存储过程失败。存储过程:CREATEPROCEDURECop_SaleForecast(@BegDateInteger,@EndDateInteger,@I

delphi7调用存储过程失败。
存储过程:
CREATE   PROCEDURE   Cop_SaleForecast(@BegDate   Integer,
                                            @EndDate   Integer,@ItemId   Varchar(18))
AS  
  select   dtl.ItemId,sum(Dtl.Qty)   as   Qty,Dtl.UntId,
    datepart(year,ShipDate)   as   date1,datepart(month,ShipDate)   as   date2
from     Cop_Ship_Dtl   Dtl,
            Cop_Ship_Mst   Mst
where     ItemId=@ItemId   and   Dtl.BillId=Mst.BillID   and   Dtl.ShipID=Mst.ShipId  
            and   mst.Status=1   and   datepart(year,ShipDate) <=@EndDate   and   datepart(year,ShipDate)> =@BegDate
group   by   datepart(year,ShipDate),datepart(month,ShipDate)     ,dtl.itemid,dtl.untid
GO

     
Delphi里:
ComText   :=   'Exec   Cop_SaleForecast   ';
        ComText   :=ComText   +   '   ' ' '   +   edtBCltId.Text   + ' ' '   ,   '     ;

        ComText   :=   ComText   + '   ' ' '+   XcEdit2.Text   + ' ' '   ,   ';

        ComText   :=   ComText   + '   ' ' '+XcEdit1.Text+ ' ' '   '   ;
运行时:未能找到存储过程

[解决办法]
//如果存储过程在数据库中存在下面的调用方法应该是没有问题的

ComText := 'Exec Cop_SaleForecast '+strToIntDef( edtBCltId.Text,0 )+ ', '+ StrToIntDef( XcEdit2.Text,0 )+ ', ' ' '+XcEdit1.Text+ ' ' ' ';

热点排行