title: Deleting a row from mysql in datagridview vb
body: <p>Could someone help me with my application, I am trying to delete a row from mysql using a datagridview in vb. For some reason it either says it cant find the column named user or it just doesnt function like it should do.</p>
  
  <p>Here is the code, I know its untidy and there are unused things but it shouldnt affect it.</p>
  
  <pre><code> Private Sub Button2_Click_1(sender As Object, e As EventArgs) Handles Button2.Click
      Try
          MySqlConnection.Open()
      Catch ex As Exception
  
      End Try
      If Me.DataGridView1.Rows.Count &gt; 0 Then
          If Me.DataGridView1.SelectedRows.Count &gt; 0 Then
              For Each row As DataGridViewRow In DataGridView1.Rows
                  Dim selUser As String = Me.DataGridView1.CurrentRow.Index
                  Dim SqlQuery As String = "DELETE FROM Report WHERE user=" &amp; row.DataBoundItem(1).ToString
                  Dim cmd As New MySqlCommand(SqlQuery, MySqlConnection)
                  cmd.ExecuteNonQuery()
                  Dim da As New MySqlDataAdapter("select * from Report", MySqlConnection)
                  Dim ds As New DataSet
                  da.Fill(ds)
                  DataGridView1.DataSource = ds.Tables(0)
              Next
          End If
  
      End If
  
  End Sub
  </code></pre>
  
  <p>EDIT: Fixed it now, thanks to everyone who answered.</p>