title: how to update a mysql database from a dataGridView in C#
body: <p><a href="https://i.stack.imgur.com/cJ1lA.png" rel="nofollow noreferrer">Picture of Visual Studio Project</a></p>
  
  <p>Hi,</p>
  
  <p>Hope someone can help. I am trying to create a vehicle log for the company I work for. I have managed to get the dataGridView to add a row to the database but, This is what I have found on the internet and it seams to work. Can anyone tell me if this is the correct way of updating the MySQL database from a dataGridView? </p>
  
  <p>NOTE: I added a timer tick so that if anyone added a new line, then the data in the dataGridView it automatically updates the MySQL database.</p>
  
  <pre><code>// saves the data in the dataGridView to the MySQL database
      private void Timer1_Tick(object sender, EventArgs e)
      {
          //int index = vehiclemovementDataGridView.SelectedRows[0].Index;
          //vehiclemovementDataGridView.Rows.
          vehiclemovementTableAdapter.Update(this.vehiclelogDataSet.vehiclemovement);
          //vehiclemovementDataGridView.Update(this.vehiclelogDataSet.vehiclemovement);
      }
  </code></pre>
  
  <p>In have not typed the connection to the database I added a dataGridView and configured it to connect the MySQL database.</p>