处理时显示进度条

发布于 2024-07-25 05:59:04 字数 81 浏览 2 评论 0原文

如果我从开始时间到结束时间从数据库获取数据,在这段时间内(处理/查询),我想显示一个进度条(类似于“正在处理,请稍候”)。 我怎样才能做到这一点?

If I am getting data from the database from start time to end time, during that time (of processing / querying), I want to display a progress bar (something like, “Processing, please wait”). How can I do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

逆流 2024-08-01 05:59:04

从数据库获取数据的步骤:

  1. 应用程序 将查询发送到数据库
  2. 数据库分析查询并准备结果
  3. 数据库将结果发送回应用程序

在大多数情况下,您无法说出需要多长时间,因此不要考虑进度条,而是考虑以下组合:

  • 沙漏鼠标 指针
  • 状态栏中的
  • “请稍候”小动画(风车、旋转齿轮等)

Steps of geting data from db:

  1. app send query to db
  2. db analyzes query and prepares result
  3. db send result back to app

In most cases you cannot say how much time it will take, so instead of progress bar think about combination of:

  • hour glass mouse pointer
  • "please wait" in status bar
  • little animation (windmill, rotating gear wheels etc)
皇甫轩 2024-08-01 05:59:04

虽然您确实无法判断查询将花费多长时间,但它可以向您的用户提供已用时间/剩余时间的信息。 您可以使用 VB IDE 中的进度条控件。 然后将其“max”属性设置为查询记录数。 当您迭代记录时,进度条的“值”属性会增加。 这是一个例子; (“Rs”是 ADODB 记录集)

        ProgressBar1.Max = Rs.RecordCount - 1

        For P = 0 To .RecordCount - 1
           ProgressBar1.Value = P

            'some process here
            Rs.MoveNext

        Next P

While its true that you cant tell how long the query is going to take, its possible to give your user and idea of the time lapsed/remaining. You use the progress bar control from your VB IDE. You then set its 'max' property to your query recordcount. As you iterate through the records increase the progress bars 'value' property. Here's an example; ('Rs' is an ADODB recordset)

        ProgressBar1.Max = Rs.RecordCount - 1

        For P = 0 To .RecordCount - 1
           ProgressBar1.Value = P

            'some process here
            Rs.MoveNext

        Next P
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文