求助,最后一条数据取不到存不到表里,高手来看看
Dim cnn As New ADODB.ConnectionDim sq As String
cnn.ConnectionString = "dsn=baifulin;uid=sa"
cnn.Open
rs.Open "select * from lab1", cnn, 1, 3
Dim i As Integer
Dim Item As ListItem
For i=1 To ListView1.ListItems.Count
If ListView1.ListItems(i).Checked Then '判断哪几条数据是被选中的
Print ListView1.ListItems(i)’这里我选几条数据就有form上打印几条,这里是正常的
rs.AddNew
rs.Fields("生产批号") = ListView1.ListItems(i)'将选中的数据存到lab1表里
'这里出问题了,无论我选几条,最后一条数据存不了
End If
Next
cnn.Close
Set cnn = Nothing