|
-
Apr 22nd, 2009, 06:12 AM
#1
Thread Starter
Junior Member
listview all item to save access Please help:(
Code:
Dim x As Integer
Call Adoconn 'CONNECTING TO DATABASE
Adodc1.RecordSource = "SELECT * FROM mytable Where aa= '" & ListView1.SelectedItem.SubItems(1) & "'"
Adodc1.Recordset.AddNew
x = ListView1.ListItems.Count
Adodc1.Recordset.Fields("aa") = ListView1.ListItems(x).SubItems(1)
Adodc1.Recordset.Fields("bb") = ListView1.ListItems(x).SubItems(2)
Adodc1.Recordset.Fields("cc") = ListView1.ListItems(x).SubItems(3)
Adodc1.Recordset.Fields("dd") = ListView1.ListItems(x).SubItems(4)
Adodc1.Recordset.Update
Adodc1.Recordset.MoveNext
I could not add records
please help me
thanx
-
Apr 24th, 2009, 05:04 AM
#2
Thread Starter
Junior Member
Re: listview all item to save access (with adodc) Please help:(
help meeeeeeeeeee
-
Apr 24th, 2009, 07:15 AM
#3
-
Apr 27th, 2009, 06:32 AM
#4
Thread Starter
Junior Member
Re: listview all item to save access Please help:(
Thanks for your help )))
I've solved. Maybe that will benefit
Code:
Dim i As Long
Dim ADOCn As ADODB.Connection
Dim ConnString As String
Dim sSQL As String
ConnString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=mydatabase.mdb;" & _
"Persist Security Info=False"
Set ADOCn = New ADODB.Connection
ADOCn.ConnectionString = ConnString
ADOCn.Open ConnString
For i = 1 To ListView1.ListItems.Count
sSQL = "INSERT INTO GarantiListe(aa) "
sSQL = sSQL & "VALUES ('" & ListView1.ListItems(i).SubItems(1) & "')" 'fields continue to be
ADOCn.Execute sSQL
Next
ADOCn.Close
Set ADOCn = Nothing
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|