vb6如何在sql查询(mysql)中添加进度条
我在表单中有以下代码,每当查询仍在执行时就会挂起表单:vb6如何在sql查询(mysql)中添加进度条,mysql,vb6,Mysql,Vb6,我在表单中有以下代码,每当查询仍在执行时就会挂起表单: 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(C
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不会告诉你一个查询离完成有多近,它只能告诉你它已经运行了多长时间,或者是什么阻碍了进程,就像其他查询阻止了它一样
如果您有一个长时间运行的查询,您需要猜测计算ETA需要多长时间。谢谢!DoEvents也没有。