Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
strsql = "delete from student_info where Student_No = " & ctrl & ""
Dim sqlcmd As New SqlClient.SqlCommand
sqlcmd.CommandText = strsql
sqlcmd.Connection = sqlconn
sqlcmd.ExecuteNonQuery()
MsgBox("Student Deleted")
Me.fillclasslist()
When I try to delete a student in the list view the error points to Sqlcmd.ExecuteNonQuery() and it says Incorrect syntax near '='.
I don't know what's wrong I tried
strsql = "delete from student_info where Student_No = '" & ctrl & "'"
then there's no error and when I try to delete it, it says Student Deleted but after I clicked on OK the student is not deleted.
Help me please. Thank you :D