为什么用dbExpress内的TSQLStoredProc控件不能传入参数到SQL_SERVER 2000内的存储过程?
我是刚申请,分还少,请各位见谅!
[1] 前端开发工具:Delphi 7.0,后台数据库:SQL_SERVER 2000
[2] 存储过程
/*-----------------------------------------------------------------------------*/
CREATE procedure pro_original_2_reg
@date_from varchar(30),
@date_to varchar(30)
as
begin
/*省略*/
end
GO
[3] 前端调用
/*-----------------------------------------------------------------------------*/
sqlspProcedure: 为dbExpress内TSQLStoredProc控件
在设定好其相应配置后(如:SQLConnection、StoredProcName),按照其默认提供的参数设置
(Params)进行修改:
[a] @RETURN_VALUE : ParamType为ptResult、DataType为ftInteger、Size为4
[b] @date_from : ParamType为ptInput、DataType为ftString
[c] @date_to : ParamType为ptInput、DataType为ftString
var
result_value : integer;
date_from, date_to : string;
//......
with sqlspProcedure do
begin
Params[0].AsInteger := result_value;
Params[1].AsString := date_from;
Params[2].AsString := date_to;
Prepared := True;
ExecProc;
Close;
end;
[4] 结果与问题: 以上运行无效,即对应参数没有传进去。但若是用SQL_SERVER查询分析器是没问题,是为什么呢?
希望各位大侠指点, 不胜感激!