关于delphi的一个问题?高手们可不可以指教一下,万分感谢

我的程序中原来有这样一段,用于将内容保存到sheet_product表中.

ADOStoredProc4ProcedureName属性赋值为find_sheet,这是我在数据库中原有的存储过程!
 
//保存SQL数据

   if ADOConnection2.Connected then begin

      ADOStoredProc4.active:=false;

      ADOStoredProc4.Parameters.ParamByName('@sheet_id').Value:=label3d54.Caption;

      ADOStoredProc4.active:=true;

      if ADOStoredProc4.recordcount=0 then begin

         sh_a_time:=now;

         pbar1.Visible:=true;

         //保存sheet_product

         with ADOStoredProc4 do begin

            Append;

            FieldByName('sheetid').Value:=label3d54.Caption;

            FieldByName('sheeterid').Value:=edit2.Text;

            FieldByName('shift_q').Value:=copy(combobox1.Text,1,1);

            FieldByName('date_q').Value:=copy(combobox5.Text,1,4)+'-'+copy(combobox6.Text,1,2)+'-'+copy(combobox7. Text,1,2)+formatdatetime(' hh:nn:ss',now);

            FieldByName('width').Value:=strtoint(floatedit1.Text);

            FieldByName('length').Value:=strtoint(floatedit2.Text);

            FieldByName('grade').Value:=copy(combobox2.Text,1,1);

            FieldByName('ream').Value:=floatedit3.Value;

            FieldByName('reams').Value:=floatedit4.Value;

            FieldByName('calc_w').Value:=strtofloat(edit6.Text);

            FieldByName('inspector').Value:=edit5.Text;

            Post;

         end;

现在我又新添加了下面一段内容: 目的是想将上面的内容再保存一次,保存到另外一个新建的lsheet_product表中去.

新增添的ADOStoredProc7ProcedureName属性赋值为find_lsheet,这是我在数据库中新建的一个存储过程!
 

         //chenjie新加下面23,作用为了保存lsheet_product

           if ADOConnection2.Connected then begin

      ADOStoredProc7.active:=false;

      ADOStoredProc7.Parameters.ParamByName('@lsheet_id').Value:=label3d54.Caption;

      ADOStoredProc7.active:=true;

      //if ADOStoredProc7.recordcount=0 then begin

        // sh_a_time:=now;

       //  pbar1.Visible:=true;

         with ADOStoredProc7 do begin

         Append;

           FieldByName('lsheetid').Value:=label3d54.Caption;

           FieldByName('lsheeterid').Value:=edit2.Text;

           FieldByName('lshift_q').Value:=copy(combobox1.Text,1,1);        FieldByName('ldate_q').Value:=copy(combobox5.Text,1,4)+'-'+copy(combobox6.Text,1,2)+'-'+copy(combobox7.                                                                           Text,1,2)+formatdatetime(' hh:nn:ss',now);

            FieldByName('lwidth').Value:=strtoint(floatedit1.Text);

            FieldByName('llength').Value:=strtoint(floatedit2.Text);

            FieldByName('lgrade').Value:=copy(combobox2.Text,1,1);

            FieldByName('lream').Value:=floatedit3.Value;

            FieldByName('lreams').Value:=floatedit4.Value;

            FieldByName('lcalc_w').Value:=strtofloat(edit6.Text);

            FieldByName('linspector').Value:=edit5.Text;

            Post;

         end;

两个存储过程的编写为:

CREATE PROCEDURE [dbo].[find_sheetid]  @sheet_id varchar(15)  AS

Select * from sheet_product

where sheetid=@sheet_id

GO

 

 

CREATE PROCEDURE [dbo].[find_lsheetid]  @lsheet_id varchar(15)  AS

Select * from lsheet_product

where lsheetid=@lsheet_id

GO

但是调试过程中总是报以下错误:

project sheet.exe raised exception class edatabaseerror with message 'adostoredproc7:cannot perform this operation on a closed dataset'. process stopped. use step or run to continue.

希望高手可以指教一下!!~~

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值