• 查询数据库中的表建个进度条


    查询数据库中的表建个进度条  >> 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.

  • 相关阅读:
    Search smarter with Apache Solr, Part 1: Essential features and the Solr schema
    不错的 solr 使用安装介绍
    Twitter.com 相对于 sina.com 门户网站的优势
    Tag的妙处
    solrj的使用 转
    Search smarter with Apache Solr, Part 2: Solr for the enterprise
    Solrj的使用
    solr实例代码 import org.apache.solr.client.solrj.SolrServer
    一篇 认为未来房价会跌的文章
    Solr Multicore 试用小记 (转)
  • 原文地址:https://www.cnblogs.com/fuyingke/p/254566.html
Copyright © 2020-2023  润新知