zoukankan      html  css  js  c++  java
  • 查询数据库中的表建个进度条

    查询数据库中的表建个进度条  >> Dev-Club开始提供RSS订阅

    jianguobu 于 2004-6-19 9:09:15 加贴在 DELPHI ←返回版面按此给该网友发送邮件 按此察看该网友的资料 按此把文章加入书签 按此给作者留言 按此给作者发送即时消息 按此查看作者个人专辑 按此打印本帖 按此打包转发本帖

    这段代码不是我自己写的,呵呵,是李维书上的.
    直接编译附件里的工程就可以看到效果了.
    unit fDemoMain;

    interface

    uses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      ComCtrls, Grids, DBGrids, ExtCtrls, DBCtrls, Db, ADODB, StdCtrls;

    type
      TForm1 = class(TForm)
        ADOConnection1: TADOConnection;
        ADODataSet1: TADODataSet;
        DataSource1: TDataSource;
        DBNavigator1: TDBNavigator;
        DBGrid1: TDBGrid;
        ADOCommand1: TADOCommand;
        ProgressBar1: TProgressBar;
        Button1: TButton;
        Button2: TButton;
        procedure FormActivate(Sender: TObject);
        procedure ADODataSet1FetchProgress(DataSet: TCustomADODataSet;
          Progress, MaxProgress: Integer; var EventStatus: TEventStatus);
        procedure Button2Click(Sender: TObject);
        procedure Button1Click(Sender: TObject);
        procedure ADODataSet1FetchComplete(DataSet: TCustomADODataSet;
          const Error: Error; var EventStatus: TEventStatus);
      private
        { Private declarations }
        lStart : Longint;
        lEnd : Longint;
      public
        { Public declarations }
      end;

    var
      Form1: TForm1;

    implementation

    {$R *.DFM}

    procedure TForm1.FormActivate(Sender: TObject);
    var
      sRecNo : String;
    begin
      ProgressBar1.Max := ADOCommand1.Execute.Fields.Item[0].Value;
      sRecNo := IntToStr(ProgressBar1.Max);
      Self.Caption := '共有' + sRecNo + ' 笔资料';
    end;

    procedure TForm1.ADODataSet1FetchProgress(DataSet: TCustomADODataSet;
      Progress, MaxProgress: Integer; var EventStatus: TEventStatus);
    begin
      ProgressBar1.Position := Progress;
    end;

    procedure TForm1.Button2Click(Sender: TObject);
    begin
      try
        ADODataSet1.Active := False;
        ADODataSet1.ExecuteOptions := [eoAsyncFetchNonBlocking];
      finally
        lStart := GetTickCount;
        ADODataSet1.Active := True;
      end;
    end;

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      try
        ADODataSet1.Active := False;
        ADODataSet1.ExecuteOptions := [eoAsyncFetch];
      finally
        lStart := GetTickCount;
        ADODataSet1.Active := True;
      end;
    end;

    procedure TForm1.ADODataSet1FetchComplete(DataSet: TCustomADODataSet;
      const Error: Error; var EventStatus: TEventStatus);
    begin
      lEnd := GetTickCount;
      ShowMessage('总共花了' + FloatToStr((lEnd - lStart) / 1000.0) + '秒');
    end;

    end.

  • 相关阅读:
    STM32 + RT Thread OS 学习笔记[三]
    全代码实现ios-1
    HTML5 Web Speech API 结合Ext实现浏览器语音识别以及输入
    全代码实现ios-2
    从零开始学C++之虚函数与多态(一):虚函数表指针、虚析构函数、object slicing与虚函数
    二进制程序分析工具Pin在Windows系统中的安装和使用方法
    使用U盘安装Ubuntu系统的实践小结
    HDU 1874 畅通工程续
    JSP页面上用横线代替文本框
    Mysql设置编码
  • 原文地址:https://www.cnblogs.com/fuyingke/p/254566.html
Copyright © 2011-2022 走看看