siva reddy

siva reddy

  • NA
  • 1
  • 0

deleting row in mysql from datagridview

Sep 10 2009 2:46 AM
i tried to delete data from datagridview . it is not deleting row in mysql but removes in datagridview.
My code is

 private void update_Click(object sender, EventArgs e)
      {
          DataTable dt = ds.Tables["distributor"];
         this.dataGridView1.BindingContext[dt].EndCurrentEdit();
            this.da.Update(dt);

        
      }

      private void delete_Click(object sender, EventArgs e)
      {
          if (dataGridView1.SelectedRows.Count == dataGridView1.Rows.Count)
          {
              dataGridView1.Rows.Clear();
          }
          foreach (DataGridViewRow row in dataGridView1.SelectedRows)
          {
              dataGridView1.Rows.Remove(row);
          }
      }
pls help me.
thank you

Answers (1)