这样的存储过程。
CREATE PROCEDURE  www
@sun1_1 char(10),
@sun2_1 char(10)
AS
insert into sun
(sun1,sun2)
values
(@sun1_1,@sun2_1)
GO
这样的代码。
procedure TForm1.Button1Click(Sender: TObject);
begin
storedproc1.DatabaseName:='human';
storedproc1.StoredProcName:='www';
storedproc1.Active:=true;
storedproc1.Close;
storedproc1.Prepare;
storedproc1.ParamByName('sun1_1').AsString:=edit1.Text;
storedproc1.ParamByName('sun2_1').AsString:=edit2.Text;
storedproc1.ExecProc;
storedproc1.Open;
datasource1.DataSet:=storedproc1;
dbgrid1.DataSource:=datasource1;
end;
这样的代码错在哪里能告诉我吗。

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    storedproc1.DatabaseName:='human';
    storedproc1.StoredProcName:='www';
    storedproc1.Active:=true;
    storedproc1.Close;
    storedproc1.Prepare;
    storedproc1.ParamByName('sun1_1').AsString:=edit1.Text;//这里错了
    storedproc1.ParamByName('sun2_1').AsString:=edit2.Text;//还有这里storedproc1.ParamByName('sun1_1').Value:=edit1.text;
    storedproc1.ParamByName('sun2_1').Value:=edit2.text;
    storedproc1.ExecProc;
    storedproc1.Open;
    datasource1.DataSet:=storedproc1;
    dbgrid1.DataSource:=datasource1;
    end;