Private Sub Form_Load()
ListView1.View = lvwReport
ListView1.GridLines = True
ListView1.ColumnHeaders.Clear
'ListView1.LabelEdit = lvwManual
ListView1.ColumnHeaders.Add , , "ID", 500
ListView1.ColumnHeaders.Add , , "姓名", 1000
ListView1.ColumnHeaders.Add , , "QQ", 1200
ListView1.ColumnHeaders.Add , , "MSN", 2500
ListView1.ColumnHeaders.Add , , "MAIL", 2000
ListView1.ColumnHeaders.Add , , "电话", 1500
ListView1.ColumnHeaders.Add , , "手机", 2000
ListView1.ColumnHeaders.Add , , "备注", 3000
Call ld
End Sub
Sub ld()
Dim con As ADODB.Connection
Dim rst As ADODB.Recordset
Dim liv As ListItem
Set con = New ADODB.Connection
Set rst = New ADODB.Recordset
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\DATA\DZ.MDB"
'rst.CursorLocation = adUseClient
rst.Open "SELECT * FROM TXL", con, adOpenStatic, adLockReadOnly
ListView1.ListItems.Clear
Do While Not rst.EOF
Set liv = ListView1.ListItems.Add(, , rst("ID"))
liv.SubItems(1) = rst("姓名")
liv.SubItems(2) = rst("QQ")
liv.SubItems(3) = rst("MSN")
liv.SubItems(4) = rst("MAIL")
liv.SubItems(5) = rst("电话")
liv.SubItems(6) = rst("手机")
liv.SubItems(7) = rst("备注")
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
con.Close
Set con = Nothing
End Sub