I am making a invoice system in Visual Basic 2010 and i am stuck here
Here is my code
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
For Each row As DataGridViewRow In datagrid.SelectedRows
Dim selectedindex As String = datagrid.CurrentRow.Cells(0).Value.ToString()
datagrid.Rows.Remove(row)
If conn.State = ConnectionState.Closed Then
conn.Open()
End If
Dim sql = "DELETE FROM sales WHERE InvoiceNo='" & txtInvoiceNo.Text & "' and id='" & selectedindex & "'"
Dim cmd As New MySqlCommand(sql, conn)
Dim reader As MySqlDataReader = cmd.ExecuteReader
If reader.Read() Then
End If
conn.Close()
reader.Close()
Next
End Sub
This code is not working well please have a look to my invoice screen shot and suggest me a better code
When i try to delete the selected row the code does not work and if any one can tell me i can delete multiple selected rows? they are deleted from the datagrid but not from database

not working well? Could you be more specific?