I know to save records from database into listview, but how to save listview to database instead..
this is the code for showing record into list view..but can any help me how to change the code to save listview into database?
Imports System.Data.OleDb
Public Class Form1
Dim con As New OleDbConnection
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
con.ConnectionString = "provider=microsoft.ACE.oledb.12.0;data source=C:\Users\asus\Documents\Visual Studio 2010\Projects\Banananana\Banananana\bin\Debug\Database.accdb"
con.Open()
showMyRecords()
con.Close()
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
Public Sub showMyRecords()
Dim dt As New DataTable
Dim ds As New DataSet
ds.Tables.Add(dt)
Dim da As New OleDbDataAdapter("Select * from Table1", con)
da.Fill(dt)
Dim myRow As DataRow
For Each myRow In dt.Rows
ListView1.Items.Add(myRow.Item(0))
ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(myRow.Item(1))
ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(myRow.Item(2))
ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(myRow.Item(3))
ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(myRow.Item(4))
Next
End Sub
End Class