var mynode:ttreenode;
mylabel:tlabel;
sp:tadostoredproc;
sp_rt,sp_prm,sp_prm_out:tparameter;
begin
sp:=tadostoredproc.Create(self);
sp.Connection:=dm_mis.miscon;
sp.ProcedureName:='pr_delclass';
sp_rt:=sp.Parameters.CreateParameter('@RETURN_VALUE',ftInteger,pdReturnValue,4,0);
sp_prm:=sp.Parameters.CreateParameter('@iid', ftString,pdinput,10,iid);
sp_prm_out:=sp.Parameters.CreateParameter('@rst', ftString,pdInputOutput,10,'9999');
sp.Prepared;
sp.ExecProc;
showmessage(sp_prm_out.Value);//错误提示sp_prm_out为空值 end;
mylabel:tlabel;
sp:tadostoredproc;
sp_rt,sp_prm,sp_prm_out:tparameter;
begin
sp:=tadostoredproc.Create(self);
sp.Connection:=dm_mis.miscon;
sp.ProcedureName:='pr_delclass';
sp_rt:=sp.Parameters.CreateParameter('@RETURN_VALUE',ftInteger,pdReturnValue,4,0);
sp_prm:=sp.Parameters.CreateParameter('@iid', ftString,pdinput,10,iid);
sp_prm_out:=sp.Parameters.CreateParameter('@rst', ftString,pdInputOutput,10,'9999');
sp.Prepared;
sp.ExecProc;
showmessage(sp_prm_out.Value);//错误提示sp_prm_out为空值 end;
返回值还是输出参数啊,如果想获得存储过程return 的值,
pdInputOutput这个应该改为pdResult
也提示null转换为string错误
as
set nocount on
declare
@icount1 int,
@icount2 int,
@sn int,
@end bit,
@msg varchar(4)set @msg='9999'
select @icount1=count(*) from codebook where iid=@iid
if @icount1<>1 set @msg='0000' --没有需要删除的记录select @icount2=count(*) from codebook where cpid=@iid
if @icount2<>0 set @msg='1111' --此分类已经有子类select @end=bend from codebook where iid=@iid
if @end=0
begin
select @sn=sn from codebook_sn where iid=@iid
if @sn<>1
set @msg='2222' --此分类已添加了物料编码
else
set @msg='9998'
endset @rst=@msg
set nocount off
with self.ADOCommand1 do
begin
Connection:=Adoconnection1;
CommandType:=cmdStoredProc;
CommandText:='pr_delclass';
Parameters.CreateParameter('@iid',ftString,pdInput,10,'1111');
Parameters.CreateParameter('@rst',ftString,pdOutput,10,'999');
Execute;
showmessage( Parameters[1].Value );
end;