butterfly|perplexed
Member
- Joined
- Sep 25, 2006
- Messages
- 7
- Programming Experience
- Beginner
Im new to vb.net. Im trying to set a delete statement to remove a company from a SQL server database. The user can select the line in the datagrid and then choose delete button.
This code deletes the whole company in the database. Can anyone help me?
If MsgBox("Are you sure you want to delete this?", MsgBoxStyle.YesNo + MsgBoxStyle.Question, "Delete") = MsgBoxResult.Yes Then
myCommand = New SqlCommand("DELETE FROM company WHERE companyID=@companyID", myConnection)
ra = myCommand.ExecuteNonQuery()
MessageBox.Show("Records affected: " & ra)
End If
This code deletes the whole company in the database. Can anyone help me?