ADOQuery 执行存储过程并取的输出参数

 ADOQuery 执行存储过程并取的输出参数  
 
写这个只是为了将来自查用的,呵呵,当然,不会的人也可以看看
第一步建立proc
create proc MyABC @a int ,@b int, @c int output
as
  set @c=@a*@b

在SQL中执行:

declare @a int,@b int,@c int
set @a=250
set @b=40
exec MyABC @a,@b,@c output --注意要添加output 关键字!
select @c

在D中:

  ADOQuery1.Close;
  ADOQuery1.SQL.Clear;
  ADOQuery1.SQL.Add(‘execute MyABC :a,:b,:c output‘);//也要添加output 关键字!
  ADOQuery1.Parameters.ParamByName(‘a‘).Value:=250;
  ADOQuery1.Parameters.ParamByName(‘b‘).Value:=40;
  ADOQuery1.ExecSQL;
  showmessage(ADOQuery1.Parameters.ParamByName(‘c‘).Value);
posted @ 2008-08-02 14:54  delphi中间件  阅读(2939)  评论(0编辑  收藏  举报