具体问题如下:
  公共函数:
  function jczf(sql_str:strin):integer;
  begin
    with pub.qjc do
     begin
      close;
      sql.clear;
      sql.add(sql_str);
      try
       open;
       if recordcount>0 then
          result:=0 else result:=-1;
      except
          result:=-1;
       raise;
      end;
     end;
   end;在软件应用中调用函数(通过一个edit或button控件--回车)如下:
  if jczf('select * from information where code=''if_yjk_zd'' and set_value=''1'' ')=0 then
  begin
   ...............
  end;
就会提示错误信息如下:(通过一个edit或button控件--回车之后会出现)
 QJC:cannot perform this operation on an open datset
 好像是不能怎样一个打开的数据????不知是咋个搞的有时又出现有时又不出现好像很不稳定!
然后退出系统的时候也有错误提示但是如果没有上面的错误提示信息退出时也不会出现错误提示信息如下:
 Application Error Exception EdatabaseError in module Vcldb50.bpl at 0008df0 QJC:cannot Perform this operation on an open dataset不知何故望高手指点我想了好长时间也没有想出来哎呀!!!!

解决方案 »

  1.   

    就是啊不知是咋个回事个老子的。搞了好长时间妈的就是出问题。我用的是delphi 5.0的有没有问题???或者有没有补丁什么的我怀疑是不是delphi 5.0本身有问题哟???
      

  2.   

    我觉得应该是数据集的控制问题,,是不能在一个打开的数据集上执行这个操作,,在对数据集执行SQL语句操作时,这个数据集必须关闭,,我很菜,我也不知道自己说的对不对,,,我也跟着学习学习
      

  3.   

    如果是delphi5.0,建议先打补丁。5。0的ado有很多的bug,我都碰上很多次了。安装补丁后大部分常见的未知错误都消失。
      

  4.   

    是用的Paradox数据库吧
    换成ACCESS数据库
      

  5.   

    关闭连接,再重新打开
    Adoconnection.Close;
    Adoconnection.Open;
      

  6.   

    很明显错了啥.set之前应该用updtata语句
      

  7.   

    按住不放出问题的原因可能是:调用的太频繁,上一次的调用还没完成,下一次又调用了,在函数中你用到的pub.qjc可能被多次几乎同时的调用进行了不同的操作,所以可能出现你的错误。如果是这个问题的话,可以考虑用局部变量来解决,而不是用全局的pub.qjc,不过速度上可能有问题,或者是再声明一个全局的变量,来判断函数是否在使用中在pub单元中声明一个全局变量
    using : boolean;function jczf(sql_str:strin):integer;
    begin
    if pub.using then 
    begin
      ShowMessage('函数使用中');
      Reult := -2;
      Exit;
    end;Pub.Using := true;
    try
      with pub.qjc do
      begin
        close;
        sql.clear;
        sql.add(sql_str);
        try
          open;
          if recordcount>0 then
          result:=0 else result:=-1;
        except
         result:=-1;
         raise;
        end;
      end;
    finally
      pub.using := false
    end;
    end;
    end;
      

  8.   

    cannot perform this operation on an open datset  这就是错误啊,提示你不能操作一个已经打开的记录啊,仔细查查其他地方有没有把那个记录集已经打开了。
      

  9.   

    我想可能是不是调用的次数多了。但是在
    function jczf(sql_str:strin):integer;
      begin
        with pub.qjc do
         begin
          close;
          sql.clear;
          sql.add(sql_str);
          try
           open;
           if recordcount>0 then
              result:=0 else result:=-1;
          except
              result:=-1;
           raise;
          end;
         end;
       end;
    是关闭了又打开的呀是不???close;
      

  10.   

    cannot Perform this operation on an open dataset
    这是dataset的状态问题。跟DELPHI没关系。不要乱戴帽子。