没有用refrsh? Dim StrQuery As String Dim RST As Recordset Dim strQuery2 As String Dim RST2 As Recordset Dim intLine As Integer Dim lv As ListItem Dim rc As RECT
If CmdQuery.Tag = 0 Then CmdQuery.Tag = 1 CmdQuery.Caption = "停 止" MousePointer = 11 If InternetCheckConnection("http://" & m_ip, FLAG_ICC_FORCE_CONNECTION, 0&) = 0 Then MsgBox "网络连接有问题,请检查网络连接!", vbInformation, "连接错误" Exit Sub End If Call CaNum StrQuery = "SELECT id,username,sex,minzu,birthday,cardno,zycode,cengci,isyz,ct_code FROM t_baoming_web WHERE id>0 " ...... Call NewRecordSet_S(RST, StrQuery) If Not RST.EOF() Then Progress.Min = 0 Progress.Max = RST.RecordCount Progress.Value = 0 lbl_renshu3.Caption = Trim(RST.RecordCount) & "人" Else lbl_renshu3.Caption = "0人" End If intLine = 1 ListV.ListItems.Clear
'LockWindowUpdate ListV.hwnd Call GetClientRect(ListV.hwnd, rc) With ListV.ListItems Do While Not RST.EOF() DoEvents If mbSearchCancel Then RST.Close: Set RST = Nothing mbSearchCancel = False CmdQuery.Tag = 0 CmdQuery.Enabled = True MousePointer = 0 Call InvalidateRect(ListV.hwnd, rc, True) Exit Sub End If Set lv = .Add(Text:=Format(intLine, "00000000")) intLine = intLine + 1 lv.ListSubItems.Add Text:=Format(RST.Fields!id, "00000000") lv.ListSubItems.Add Text:=Trim(RST.Fields!UserName) If UCase(RST.Fields!sex) = UCase("M") Then lv.ListSubItems.Add Text:="男" ElseIf UCase(RST.Fields!sex) = UCase("F") Then lv.ListSubItems.Add Text:="女" End If lv.ListSubItems.Add Text:=Trim(RST.Fields!minzu) lv.ListSubItems.Add Text:=Format(Trim(RST.Fields!birthday), "YYYY年mm月dd日") lv.ListSubItems.Add Text:=Trim(RST.Fields!cardno) strQuery2 = "SELECT * FROM t_zhuanye WHERE zycode='" & RST.Fields!zycode & "'" Call NewRecordSet_L(RST2, strQuery2) If Not RST2.EOF() Then lv.ListSubItems.Add Text:=RST2.Fields!zhuanye End If strQuery2 = "SELECT * FROM t_cengci WHERE cccode='" & RST.Fields!cengci & "'" Call NewRecordSet_L(RST2, strQuery2) If Not RST2.EOF() Then lv.ListSubItems.Add Text:=RST2.Fields!cengci End If If RST.Fields!isyz = 1 Then lv.ListSubItems.Add Text:="已验证" Else lv.ListSubItems.Add Text:="未验证" End If
strQuery2 = "SELECT * FROM t_yixiang WHERE cid='" & RST.Fields!ct_code & "'" Call NewRecordSet_L(RST2, strQuery2) If RST2.RecordCount >= 1 Then lv.ListSubItems.Add Text:=Trim(RST2.Fields!name) Else ListV.ListItems.Clear
End If Call ValidateRect(ListV.hwnd, rc) RST.MoveNext
If (Progress.Value + 1) <= Progress.Max Then Progress.Value = Progress.Value + 1 End If If CmdQuery.Tag = 0 Then Exit Do End If
Loop Call InvalidateRect(ListV.hwnd, rc, True)
' LockWindowUpdate 0
End With CmdQuery.Tag = 0 MousePointer = 0 CmdQuery.Caption = "查 询" CmdQuery.Enabled = True Else CmdQuery.Tag = 0 CmdQuery.Caption = "查 询" End If
WWW.mndsoft.com
中去找一个用类做的listview.
他加载数据的速度超快/.
Dim RST As Recordset
Dim strQuery2 As String
Dim RST2 As Recordset
Dim intLine As Integer
Dim lv As ListItem
Dim rc As RECT
If CmdQuery.Tag = 0 Then
CmdQuery.Tag = 1
CmdQuery.Caption = "停 止"
MousePointer = 11
If InternetCheckConnection("http://" & m_ip, FLAG_ICC_FORCE_CONNECTION, 0&) = 0 Then
MsgBox "网络连接有问题,请检查网络连接!", vbInformation, "连接错误"
Exit Sub
End If
Call CaNum
StrQuery = "SELECT id,username,sex,minzu,birthday,cardno,zycode,cengci,isyz,ct_code FROM t_baoming_web WHERE id>0 "
......
Call NewRecordSet_S(RST, StrQuery)
If Not RST.EOF() Then
Progress.Min = 0
Progress.Max = RST.RecordCount
Progress.Value = 0
lbl_renshu3.Caption = Trim(RST.RecordCount) & "人"
Else
lbl_renshu3.Caption = "0人"
End If
intLine = 1
ListV.ListItems.Clear
'LockWindowUpdate ListV.hwnd
Call GetClientRect(ListV.hwnd, rc)
With ListV.ListItems
Do While Not RST.EOF()
DoEvents
If mbSearchCancel Then
RST.Close: Set RST = Nothing
mbSearchCancel = False
CmdQuery.Tag = 0
CmdQuery.Enabled = True
MousePointer = 0
Call InvalidateRect(ListV.hwnd, rc, True)
Exit Sub
End If
Set lv = .Add(Text:=Format(intLine, "00000000"))
intLine = intLine + 1
lv.ListSubItems.Add Text:=Format(RST.Fields!id, "00000000")
lv.ListSubItems.Add Text:=Trim(RST.Fields!UserName)
If UCase(RST.Fields!sex) = UCase("M") Then
lv.ListSubItems.Add Text:="男"
ElseIf UCase(RST.Fields!sex) = UCase("F") Then
lv.ListSubItems.Add Text:="女"
End If
lv.ListSubItems.Add Text:=Trim(RST.Fields!minzu)
lv.ListSubItems.Add Text:=Format(Trim(RST.Fields!birthday), "YYYY年mm月dd日")
lv.ListSubItems.Add Text:=Trim(RST.Fields!cardno)
strQuery2 = "SELECT * FROM t_zhuanye WHERE zycode='" & RST.Fields!zycode & "'"
Call NewRecordSet_L(RST2, strQuery2)
If Not RST2.EOF() Then
lv.ListSubItems.Add Text:=RST2.Fields!zhuanye
End If
strQuery2 = "SELECT * FROM t_cengci WHERE cccode='" & RST.Fields!cengci & "'"
Call NewRecordSet_L(RST2, strQuery2)
If Not RST2.EOF() Then
lv.ListSubItems.Add Text:=RST2.Fields!cengci
End If
If RST.Fields!isyz = 1 Then
lv.ListSubItems.Add Text:="已验证"
Else
lv.ListSubItems.Add Text:="未验证"
End If
strQuery2 = "SELECT * FROM t_yixiang WHERE cid='" & RST.Fields!ct_code & "'"
Call NewRecordSet_L(RST2, strQuery2)
If RST2.RecordCount >= 1 Then
lv.ListSubItems.Add Text:=Trim(RST2.Fields!name)
Else
ListV.ListItems.Clear
End If
Call ValidateRect(ListV.hwnd, rc)
RST.MoveNext
If (Progress.Value + 1) <= Progress.Max Then
Progress.Value = Progress.Value + 1
End If
If CmdQuery.Tag = 0 Then
Exit Do
End If
Loop
Call InvalidateRect(ListV.hwnd, rc, True)
' LockWindowUpdate 0
End With
CmdQuery.Tag = 0
MousePointer = 0
CmdQuery.Caption = "查 询"
CmdQuery.Enabled = True
Else
CmdQuery.Tag = 0
CmdQuery.Caption = "查 询"
End If