毕
毕常青
Unregistered / Unconfirmed
GUEST, unregistred user!
动态创建一个存储过程 createprocA:='Create Procedure ProcA'+ '(' + '@Seqno varchar(16),'+ '@AccNo varchar(22),' + '@AccName varchar(60)'+ ')' + ' AS '+ 'insert into A1' + '(' + 'seqno,'+ 'accno,'+ 'accname'+ ')'+ ' values '+ '('+ '@Seqno,'+ '@AccNo ,' + '@AccName '+ ')' ; with qry2 do begin close; sql.Clear; sql.Add(CreateProcA) ; execsql; end;调用存储过程procedure TForm2.Button7Click(Sender: TObject);var StoredProc : TADOStoredProc;begin StoredProc:=TADOStoredProc.Create(nil); try StoredProc.Connection := AdoConnection1; //设置数据连接 StoredProc.ProcedureName := 'ProcA'; //存储过程名 with storedproc do begin Parameters.ParamByName('@seqno').Value := '20000'; parameters.ParamByName('@accno').Value := '123456'; parameters.ParamByName('@accname').Value :='nosubject'; Prepared := True; ExecProc; end; finally StoredProc.Free;end;[red]有错误提示.Parameter ‘@seqno’ not found请各位帮助调试一下。[/red]