部分代码如下,因为执行的存储过程时间比较长,所以就用一个进度条来显示这段时间
但是,我的那两个方法都为被调用,进度条也没有显示什么,
忘高手指点...
存储过程是:
update table set color=color1 where color=color2
.
.
.
11张表都是这样的修改...
-----------------------------------------------------
qryPro := TADOQuery.Create(nil);
qryPro.ExecuteOptions := [eoAsyncFetchNonBlocking];
qryPro.OnFetchProgress := qryProSetFetchProgress;
qryPro.Close;
Connection.ConnectOptions :=coAsyncConnect;
qryPro.Connection := Connection;
qryPro.CommandTimeout := 1800;
qryPro.SQL.Clear;
qryPro.SQL.Text := ' exec sp_RefreshColor  '''+color1+''','''+color2+''','''+msg+'''   ';
qryPro.ExecSQL;-----------------------------------------------------procedure TPPSampleSendCustFrm.qryProFetchComplete(
  DataSet: TCustomADODataSet; const Error: Error;
  var EventStatus: TEventStatus);
begin
  SystemInfo('end_!',0);
end;procedure TPPSampleSendCustFrm.qryProFetchProgress(
  DataSet: TCustomADODataSet; Progress, MaxProgress: Integer;
  var EventStatus: TEventStatus);
begin   CttProgressBar1.Position := (Progress*100) div MaxProgress ;
   CttProgressBar1.Properties.Max := MaxProgress;
   Application.ProcessMessages;end;

解决方案 »

  1.   

    把这句注释掉试试看:
    CttProgressBar1.Properties.Max := MaxProgress;
      

  2.   


    qryProFetchComplete
    qryProFetchProgress这两个方法中用:systeminf(...);都没有显示
    所以我是确定这两个方法没有被调用..
      

  3.   

    除非你在线程中调用STP 或在另一个线程中来刷新“假”进度条吧?一般调用数据库操作时都是阻塞的啦,等你的进度条代码可以执行了,存储过程也执行完了。 
      

  4.   

    我换了一个方法:
    --
    function MyThreadFun : Boolean;stdcall;
    --这是实际条用的过程var hThread:Thandle;  ThreadID:DWord;
    ThreadID := CreateThread(nil,0,@MyThreadFun,nil,0,hThread);
    ....//执行存储工程
    .
    .
    .
    --
    function TPPSampleSendCustFrm.MyThreadFun :Boolean;stdcall;
    begin
          ....//循环,使进度条滚动
    end;
      

  5.   

    这种方式它提示:variable required
    ????????
    谁能帮帮我????????
    不要贴网上的代码,谢谢........