我想不可能!
因为你无法预计 SQL查询(应该是网络数据库吧?比如说,如果网络中断?) 的进度。而且,查询是在服务器端进行,得出结果之后,才回传到客户端。当然,如果你用多线程进行后台查询,则可以显示一些动态的等待动画,并且可以让用户中断查询(强行中断查询进程)。

解决方案 »

  1.   

    同意以上的观点,不过,如果按JLL所说,速度会很慢的。
      

  2.   

    我查阅过很多书籍及各种网络资料,得出的结论是没有办法用ProgressBar来反映SQL查询时的进度!现粘贴一段文章如下:QuestionHow can i draw a gauge bar during a tquery.open session? I know the record
    count of the table (=100%), but how can i get the actual record, which tquery
    is processing? how can i operate during running query?
    AnswerA:
    Not possible.
    没有可能!!The idea behind the TQuery object is to have a SQL server process the
    request in the background and take the local machine completely out of
    the loop. The app is never supposed to know what the TQuery is doing,
    so a gauge that measures progress would have to get its data from a
    SQL server. Since most SQL servers dont publish this info, you are
    probably out of luck on this one...A:
    If you're using Paradox or DBase I think you can use the
    如果你是使用 Paradox 或者 DBase,我想你可以使用DBIRegisterCallback凾数DBIRegisterCallback function>From the DBE users manual:Usage:
    Callbacks are used when a client application needs clarification about a given
    engine function before completing an operation or to return information to the
    client. DBIRegisterCallback allows the client to instruct the database engine
    about what further actions should be taken by the engine upon occurence of an
    event.I've never used it before, so I can't give you the details.不过,在Rxlib2.75中有个DBProgress,据帮助文件说可以显示QUERY的进度,但我没有试过,不好说。你可以到http://delphis.yeah.net的“Rxlib专栏”中下载2。75版本试试!
      

  3.   

    不可能,因为查询在服务器端运行,有很多因素(锁定..),除非用TABLE 自已写。
      

  4.   

    RXLIB!!!
    看看他的例子就行了。