Hi, just wanted to know how to delete a record from datagrid, i tried the following code but it gave me an error in deleting records, I am using Mysql Database.
Following is the code:
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
'recorddelete()
Dim sql As String
Dim db As New DBHelper
Dim rows As Integer
sql = "delete from budget_details where ID = & DataGridView1.CurrentRow.Cells(0).Value.ToString()& "
rows = db.executeQuery(sql)
If (rows > 0) Then
MsgBox("Sucessfully Record Deleted")
Else
MsgBox("Error in Deleting Record")
End If
End Sub
I think problem is in this line, may be syntax problem:
sql = "delete from budget_details where ID = & DataGridView1.CurrentRow.Cells(0).Value.ToString()& "
Please help...........