I have two tables major and student
majorname is the foreign key of Student table
Student primary key=Reg_No
I want to delete entire student record from student i used the coding like this...........
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click myConnection = New SqlConnection(connectionstring) myConnection.Open() myCommand = New SqlCommand("DELETE From(Student)Where =(Select MajorName from Major Where MajorName = '" & cmbMajorI.Text & "'", myConnection) myCommand.ExecuteNonQuery() MsgBox("CORRECT") myConnection.Close() End Sub
but i got the error like this :Incorrect syntax near '('. Incorrect syntax near 'Electronics'.
Electronics is one of major name