title: Delete selected row from datagrid view and update mysql database in C#
body: <p>m developing application for my office and in my application there is a datagrid view that linked to a mysql database. local users can update the database using datagridview but they cant delete any recodes. i want to implement a method that user's are select exact raw in the datagridview and delete it  as well as delete the database record soon. i managed to make select and delete datagridview row using below code but it not update the database   </p>
  
  <pre><code>private void button60_Click(object sender, EventArgs e)
          {
              foreach (DataGridViewCell oneCell in dataGridView1.SelectedCells)
              {
                  if (oneCell.Selected)
                      dataGridView1.Rows.RemoveAt(oneCell.RowIndex);
              }
  
          }
  </code></pre>
  
  <p>and this is my connection string that i normally use to view the database data in datagrid view. i don't have good knowledge to combined these two.can someone please show me how to do that</p>
  
  <p>my connection string </p>
  
  <p>private void showdatagrid()
          {</p>
  
  <pre><code>        string constring = string.Format("datasource='{0}';username=******;port=3306;password=***********;Connect Timeout=20000;Command Timeout=28800", dbserverip.Text);
          MySqlConnection conwaqDatabase = new MySqlConnection(constring);
          MySqlCommand cmdwaqDatabase = new MySqlCommand(" select * from warit.loans ; ", conwaqDatabase);
  
  
          try
          {
  
              MySqlDataAdapter sda = new MySqlDataAdapter();
              sda.SelectCommand = cmdwaqDatabase;
              dbdataset = new DataTable();
              sda.Fill(dbdataset);
              BindingSource bsource = new BindingSource();
  
              bsource.DataSource = dbdataset;
              dataGridView1.DataSource = bsource;
              sda.Update(dbdataset);
  
          }
  
  
          catch (Exception ex)
          {
  
  
              MessageBox.Show(ex.Message);
  
          }
  </code></pre>