title: How can I Update access database from vb.net app
body: <p>How can I update my access database in vb.net code I use OleDb connection to the database it's make change in datagridview but not into the database</p>
  
  <pre><code>    Public Sub executquery()
          Dim commandOleDb As New OleDbCommand(query, con)
          commandOleDb.ExecuteNonQuery()
          con.Close()
      End Sub
  --------------------
      Private Sub ButtonInsert_Click(sender As Object, e As EventArgs)
          Dim con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Almaashat.accdb")
          Dim query As String
          Try
              con.Open()
              query = "INSERT INTO Techers (File_ID,Name,Workplace,Jop,Appointment,Class,Birthday,End_date,End_class,End_for,Note) VALUES (" &amp; TextBoxFile_ID.Text &amp; " ,'" &amp; TextBoxName.Text &amp; "' ,'" &amp; TextBoxWorkplace.Text &amp; "' ,'" &amp; TextBoxJop.Text &amp; "'  ,'" &amp; DateTimePickerAppoiment.Text &amp; "','" &amp; TextBoxClass.Text &amp; "','" &amp; DateTimePickerBirthday.Text &amp; "' ,'" &amp; DateTimePickerEnd_date.Text &amp; "' ,'" &amp; TextBoxEnd_class.Text &amp; "','" &amp; TextBoxEnd_for.Text &amp; "' ,'" &amp; TextBoxNote.Text &amp; "')"
              executquery()
              con.Close()
              MsgBox("Your Data Inserted")
          Catch ex As Exception
              MsgBox("Your Data Not Inserted")
          End Try
          TechersDataGridView.DataSource = TechersBindingSource
      End Sub
  </code></pre>