adodataset1 的特殊用法
存储过程
CREATE PROCEDURE adddata @name nvarchar(20) , @mm nvarchar(20) , @ddd nvarchar(30), @rdata nvarchar(30) AS INSERT INTO table (name,mm,ddd) VALUES (@name,@mm,@ddd) set @redata='操作成功'; select @redata as redata return 1 GO
delphi代码片段
procedure TForm1.BitBtn1Click(Sender: TObject); var tstr:string; begin tstr:='123'; ADODataSet1.Close; ADODataSet1.CommandText:='adddata a,a,a,'+tstr;//此处写存储过程 showmessage(ADODataSet1.CommandText); ADODataSet1.Open; showmessage(ADODataSet1.FieldByName('redata').AsString);//此处是返回值 end;