一个关于ADOStoredProc控件的参数传递问题

xw_xw 2003-04-22 02:44:20
用一个ADOStoredProc 控件ADOStoredProc1访问数据库其ProcedureName 属性为存贮过程Proc_wcp.
存贮过程Proc_wcp如下:
create Procedure [Proc_wcp]
@bizong varchar
as
select col1 from table1 where col2 like '+@bizong'+'%'



客户端程序代码如下:

Procedure Tfrm_wcp.SpeedButton1Click(Sender:TObject);
begin
with ADOStoredProc1 do begin
Parameters[1].value:=combobox1.text
execproc;
end;

不知何故,客户端选择的参数(combobox1.text)无法传递到存贮过程Proc_wcp的变量@bizong中。
...全文
35 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
boz 2003-04-22
  • 打赏
  • 举报
回复
//给你个例子
with form1.adostoredproc1 do
begin
close;
procedurename:='mywage';
parameters.Clear;
parameters.CreateParameter('@lnmonth',ftInteger,pdinput,8,0);
Parameters.ParamByName('@lnmonth').Value :=mm-1;
try
open;

except
Application.MessageBox('连接数据库失败','系统提示',mb_OK);
Application.Terminate;
end
end;

----------------存储过程:mywage--------------------------
CREATE PROCEDURE mywage @lnmonth int
AS
select a.nameid,a.name,(year(getdate())-year(a.workage)+1)*5 as gl,b.dagz,b.gjj,b.ydj,
case a.rank
when '技术员' then 20
when '助工' then 50
when '工程师' then 80
when '高工' then 100
end as zz
from human a left join wage b on a.nameid=b.nameid and b.wagemonth=@lnmonth
GO


5,931

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧