elianeasmar
Well-known member
- Joined
- Oct 3, 2013
- Messages
- 76
- Programming Experience
- Beginner
Hello. I have this code to delete a record from m database(i am using SQL Server)
am i missing something. Because it wont delete the record
And i have no errors. It just don't delete the record.
Am i missing something ?
Thank you
am i missing something. Because it wont delete the record
And i have no errors. It just don't delete the record.
Private Sub cmdDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDelete.Click Dim strconnection As String = "Data Source=EASMAR-PC;Initial Catalog=DatabaseConnection;Integrated Security=True;" Dim _cn As SqlConnection = New SqlConnection(strconnection) Dim cmd As New SqlCommand _cn.Open() cmd.CommandText = "delete from tblCustomer where ID=" & txtCurrent.Text & ";" cmd.Connection = _cn If MessageBox.Show("Do you really want to Delete this Record?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = DialogResult.No Then MsgBox("Operation Cancelled") Exit Sub Else cmd.ExecuteNonQuery() Me._DataAdapter.Fill(Me._DataSet) End If End Sub
Am i missing something ?
Thank you