1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
| Private Sub ReadXLSX(strPath As String)
Dim conn As OleDb.OleDbConnection
Dim dta As OleDbDataAdapter
Dim dts As DataSet
conn = New OleDbConnection("provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & strPath & ";Extended Properties=Excel 12.0;")
dta = New OleDbDataAdapter("select * from [各壇報名表$]", conn)
dts = New DataSet
dta.Fill(dts, "[各壇報名表$]")
dtt = dts.Tables("[各壇報名表$]")
conn.Close()
For Each row As DataRow In dtt.Rows()
If row(0).ToString = "完成" Then
Dim lvwi As ListViewItem
lvwi = ListView1.Items.Add(row(1).ToString)
lvwi.SubItems.Add(row(2).ToString)
lvwi.SubItems.Add(row(3).ToString)
lvwi.SubItems.Add(row(4).ToString)
lvwi.SubItems.Add(row(5).ToString)
lvwi.SubItems.Add(row(6).ToString)
lvwi.SubItems.Add(row(7).ToString)
lvwi.SubItems.Add(row(8).ToString)
lvwi.SubItems.Add(row(9).ToString)
lvwi.SubItems.Add(row(10).ToString)
lvwi.SubItems.Add(row(11).ToString)
lvwi.SubItems.Add(row(12).ToString)
lvwi.SubItems.Add(row(13).ToString)
End If
Next
End Sub
|
沒有留言:
張貼留言