Òª ADO·Ö Åú ÏÔ Ê¾ Êý ¾Ý £¬ ¾Í ±Ø Ðë Òª ÓÃ ADO´ú Âë ¶ø ²» ÓÃ ADO¿Ø ¼þ ¡£ ÔÙ ¾Í ÊÇ Äã ×î ºÃ ²» Òª ÓÃ MSHFlexGridÖ® Àà µÄ ¿Ø ¼þ £¬ Òò Îª Õâ Àà ¸ß ¼¶ ¿Ø ¼þ ÖÇ ÄÜ ÐÔ Ì« µÍ £¬ ½¨ Òé Äã ÓÃ ListView¿Ø ¼þ £¬ È» ºó Àû ÓÃ Ñ­ »· Ìí ¼Ó ¡£ ÏÂ Ãæ Îª ÎÒ ÊÔ Ð´ µÄ Ò» ¶Î ³Ì Ðò £¬ Òò Îª Ê± ¼ä ´Ò Ã¦ £¬ Ö» ÊÇ Êµ ÏÖ ÁË Æä ´ó ÖÂ ¹¦ ÄÜ £¬ Ï£ Íû Äã ÄÜ ÓÐ Ëù Æô ·¢ ¡£ 
    ´ú Âë Ê¾ Àý £º 
    Option Explicit 
     
    Dim ac As New ADODB.Connection 
    Dim ar As New ADODB.Recordset 
     
     
    Private Const database_path="******************" '//////Êý ¾Ý ¿â Â· ¾¶ 
    Private Const database_name = "******" '//////Êý ¾Ý ¿â Ãû 
    Private Const user_id = "*****" '//////ÓÃ »§ Ãû ³Æ 
    Private Const password = "****" '//////ÃÜ Âë 
    Private Const table_name = "****" '//////±í Ãû 
     
     
    Dim i, j As Integer 
    Dim itmX As ListItem 
    Dim r_cnt As Long '//////¼Ç Â¼ Êý 
    Dim cnt As Integer 
    Dim now_seat As Long 
     
     
    Private Sub cmd_next_Click() 
     If cnt < 199 Then Exit Sub 
     ListView.ListItems.Clear 
     cnt = 199 
     If r_cnt < now_seat + 199 Then cnt = r_cnt - now_seat - 2 
     Call nxt_200 
    End Sub 
     
     
    Private Sub cmd_Prevoius_Click() 
     If now_seat <= 200 Then Exit Sub 
     ListView.ListItems.Clear 
     cnt = 199 
     Call pre_200 
    End Sub 
     
     
    Private Sub Cmd_add_Click() 
    '//////////////Ìí ¼Ó Ö¸ ¶¨ Êý Ä¿ µÄ ¼Ç Â¼ 
    Dim i As Long 
     On Error Resume Next 
     With ar 
     For i = 1 To CInt(Text1) 
     .AddNew 
     !ID = i 
     !Content = "this is only for test!" 
     .Update 
     Next i 
     End With 
    End Sub 
     
     
    Private Sub Cmd_clear_Click() 
    '///////////////Çå ¿Õ Ëù ÓÐ ¼Ç Â¼ 
     With ar 
     If .EOF Then Exit Sub 
     .MoveFirst 
     Do While Not .EOF 
     .Delete 
     .MoveNext 
     Loop 
     End With 
    End Sub 
     
     
     
    Private Sub Form_Load() 
     ListView.View = lvwReport 
     ac.ConnectionString = "Data Source=" & App.Path & "/" & database_name & ";User ID=" & user_id & _ 
     ";Jet OLEDB:Database Password=" & password 
     ac.CommandTimeout = 100 
     ac.Provider = "Microsoft.Jet.OLEDB.3.51" 
     ac.Open 
     ar.Open table_name, ac, adOpenKeyset, adLockOptimistic, adCmdTable 
     With ar 
     For i = 0 To .Fields.count - 1 '////////////Ìí ¼Ó ×Ö ¶Î µ½ ±í Í· 
     ListView.ColumnHeaders.Add , , .Fields(i).Name, ListView.Width / .Fields.count 
     Next i 
     r_cnt = .RecordCount 
     If r_cnt >= 200 Then 
     cnt = 199 
     Else 
     cnt = r_cnt - 1 
     End If 
     End With 
     now_seat = 1 
     Call nxt_200 
    End Sub 
     
     
    Private Sub Form_Unload(Cancel As Integer) 
     ar.Close 
     ac.Close 
    End Sub 
     
     
    Private Sub nxt_200() 
     With ar 
     For i = now_seat To now_seat + cnt 
     Set itmX = ListView.ListItems.Add(, , .Fields(0).Value) 
     For j = 1 To .Fields.count - 1 
     itmX.SubItems(j) = .Fields(j).Value 
     Next j 
     Me.Show 
     .MoveNext 
     Next i 
     End With 
     now_seat = now_seat + cnt 
    End Sub 
     
     
    Private Sub pre_200() 
     With ar 
     For i = 1 To 400 
     .MovePrevious 
     Next i 
     For i = now_seat To now_seat + cnt 
     Set itmX = ListView.ListItems.Add(, , .Fields(0).Value) 
     For j = 1 To .Fields.count - 1 
     itmX.SubItems(j) = .Fields(j).Value 
     Next j 
     .MoveNext 
     Next i 
     End With 
     now_seat = now_seat - cnt 
    End Sub 
<END>