Deleting from database
Posted on 2006-03-22
Getting late in the day, easy question possible, what am I doing wrong?
All I am trying to do is delete a row from Table EmployeeSkills, when SkillId = txtSkillId and employeeId = txtemployeeId.
Help Please : ) Thanks
Private Sub btnDeleteSkill_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDeleteSkill.Click
Dim Result As Integer = MsgBox("Confirm Delete of this Skill???", _
MsgBoxStyle.OKCancel, "Deleting Skill")
If Result = MsgBoxResult.OK Then
Dim objCommand As SqlCommand = New SqlCommand()
objCommand.Connection = objConnection
objCommand.CommandText = "DELETE FROM EmployeeSkills " & _
"Where EmployeeSkill.EmployeeId = '" & txtEmployeeId.Text & "' AND EmployeeSkill.SkillId = '" & txtSkillId.Text & "' "
StatusBar1.Text = "Record Deleted"
ElseIf Result = MsgBoxResult.Cancel Then
MsgBox("Please ammend and press Delete when correct, or cancel to end Deleting")