【问题标题】:vb6-how to add progress bar on sql query (mysql)vb6-如何在sql查询(mysql)上添加进度条
【发布时间】:2017-11-08 05:17:24
【问题描述】:

我在一个表单中有以下代码,只要查询仍在执行,它就会挂起表单:

Public Function OpenRS(strSql As String) As ADODB.Recordset
Dim rs As ADODB.Recordset

        Set rs = New ADODB.Recordset
        rs.CursorLocation = adUseClient
        rs.CursorType = adOpenDynamic

        If IsNull(Cn) = False Then
            rs.Open strSql, Cn, adOpenKeyset, adLockPessimistic ', adAsyncExecute
        End If

        Set OpenRS = rs

End Function

尝试添加 adAsyncExecute 但表单关闭。

Dim RSC As ADODB.Recordset
    Set RSC = Nothing
    Set RSC = Cn.Execute("CALL SP_Rank_by_Company('" & MyDate1 & "','" & MyDate2 & "','DELETE')", , adAsyncExecute)

    While Cn.State = 4
        If frmLoadingReports.picLoading.Width = 5320 Then
            frmLoadingReports.picLoading.Width = 0
        Else
            frmLoadingReports.picLoading.Width = frmLoadingReports.picLoading.Width + 100
        End If
        'count total records
        'get the current number of records processed
        DoEvents
    Wend

如何添加进度条?

谢谢!

【问题讨论】:

    标签: mysql vb6


    【解决方案1】:

    MySQL 不会告诉您查询有多接近完成,它只能告诉您它运行了多长时间或阻碍了进度,就像其他查询阻止了它一样。

    如果您有一个非常长时间运行的查询,您需要猜测要计算 ETA 需要多长时间。

    【讨论】:

    • 谢谢! DoEvents 也没有。
    猜你喜欢
    • 1970-01-01
    • 2022-12-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-10
    • 2018-05-28
    • 1970-01-01
    相关资源
    最近更新 更多