I am using the following code to delete record it did not delete record but just only populate message record deleted successfully what should i do now please please help me.
If TextBox1.Text = "" Then
MessageBox.Show("Please Select record to delete......", "ALI ENTERPRISES", MessageBoxButtons.OK, MessageBoxIcon.Information)
Exit Sub
End If
If MessageBox.Show("Do you really want to Delete this Record?", _
"ALI ENTERPRISES", MessageBoxButtons.YesNo, _
MessageBoxIcon.Warning) = DialogResult.Yes Then
MessageBox.Show("Record Deleted Successfully......", "ALI ENTERPRISES", MessageBoxButtons.OK, MessageBoxIcon.Information)
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
Else
Exit Sub
End If
Dim con As New SqlConnection
Dim cmd As New SqlCommand
Try
con.ConnectionString = "Data Source=ITS;Initial Catalog=Payment;Integrated Security=True"
con.Open()
cmd.Connection = con
cmd.CommandText = "DELETE FROM CustomerInformation WHERE CustomerID ='" & Trim(TextBox4.Text) & "'"
cmd.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show("Error while Deleting record From table..." & ex.Message, "Delete Records")
Finally
If con.State = ConnectionState.Open Then
con.Close()
End If
End Try