Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21174

Listview items/rows to access db

$
0
0
I've been trying to import or save my listview items/rows/content to access db.. ive been playing around this code:

Code:

Set rs = New ADODB.Recordset
rs.Open "Select * from TblSearchMainAssets", cn, adOpenKeyset, adLockOptimistic
For Each itm In ListView1.ListItems
rs.AddNew
rs.Fields("Assettag") = ListView1.SelectedItem.Text
rs.Fields("AssetDescription") = ListView1.SelectedItem.SubItems(1)
Next
rs.Update
rs.Requery
MsgBox "done"
rs.Close
Set rs = Nothing

but it only save the item on the first row of my database. Any idea on what I should do with the code?
Thanks in advance

Viewing all articles
Browse latest Browse all 21174

Trending Articles