我在程序中,加入一个连接数据库组件,加入一个TstoreProc组件,把它与连接数据库的组件关联起来,
在TstoreProc中把params加入两个参数,可是在执行的时候,总提示 list index bound(0),提示大概是这个意思,我记不大清楚了!
请各位高人指点!!
在TstoreProc中把params加入两个参数,可是在执行的时候,总提示 list index bound(0),提示大概是这个意思,我记不大清楚了!
请各位高人指点!!
有两个参数,格式是这样的!
CREATE PROC SalesPrco @clientICID int,@gascount int
as
update icinfor
currentcount=currentcount+@gascount
where icid=@clientICID
定义了一个数据模块DMD,向DMD中加入一个连接数据库组件SQLConn : TSQLConnection,
一个数据库的执行模块SQLProcSales : TSQLStoredProc,
各属性设置如下:
SQLConn
ConnnectionName: databaseName (是MSQL2000)
Connected: true
SQLProcSales
SQLConnection:SQLConn
storedProcName:salesProc
params: 0-clientICID
clientICID的属性是:
属性是:datatype:ftsamllint,paramtype:ptInput,valaue.type:shortint后台数据库的存储过程如下:
CREATE PROCEDURE SalesProc @ClientICID int
as
begin
update ICInfor
set
currentCount = currentCount+5,SumCount=SumCount+5
where ICID =@clienticidend
GO
源代码如下:
DMD.SQLProcSales.Params.ParamByName('clienticid').Value:=7;
DMD.SQLProcSales.ExecProc;
ShowMessage('proc yes')
运行的时候,程序出现这样的错误,
list index out of bound(0)
我不明白,为何出现这样的错主误!用上述方法,执行不含参数的过程时,能够通过!
CREATE PROCEDURE [dbo].[changePassword]
@userCode char(11),
@oldPass char(40) ,
@newPass char(40)
AS
select name from worker_code where code=@userCode and [password] =@oldPassdelphi 代码
adoSP.ProcedureName:='changePassword';
adoSP.Prepared:=true;
adoSP.Parameters.CreateParameter('@userCode',ftString,pdInput,11,main_frm.UserInfo.code);
adoSP.open // 有返回
adoSP.active=true // 无返回
DMD.SQLProcSales.Params.reflesh