title: Datagridview save changes to Database vb.net
body: <p>Hello i've a databse that i load to Datagridview in vb.net application.
  it loads fine, however when i try to save the date it doesn't work.
  here is the code</p>
  
  <pre><code>    Private myConString As String
  Private con As OleDbConnection = New OleDbConnection
  Private Dadapter As OleDbDataAdapter
  Private DSet As DataSet
  Private DSet2 As DataSet
  Private ConCMD As OleDb.OleDbCommand
  
  Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
      myConString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=e:\Database31.accdb"
      con.ConnectionString = myConString
      con.Open()
      Dadapter = New OleDbDataAdapter("select * from Table1", con)
      DSet = New DataSet
      Dadapter.Fill(DSet, "Table1")
      DataGridView1.DataSource = DSet.Tables("Table1")
      con.Close()
  End Sub
  
  
  Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
      con.Open()
      Dadapter.Update(DSet, "Table1")
      DSet.AcceptChanges()
      con.Close()
  End Sub
  </code></pre>
  
  <p>Update requires a valid InsertCommand when passed DataRow collection with new rows.
  what am i supposed to do?</p>
  
  <p>the accessdatabase 3 colmuns and ID is primary key
  ID  Field1  Field2</p>