Hi every one i am having some problem in deleting customer Record. I have also uploading the screen shot of my form. i have customer records in textboxes and booking records in datagridview . i have solved the problem to delete the records in gridview but i want a button which when i click deletes both customer and related booking records. I can do this task using binding navigator cross button but i dont want to use that instead i want to use coding under a button click event please help.here is the screen shot
Jump to Post
Dim conn As New SqlConnection("ConnectionStringGoesHere") Dim cmd As New SqlCommand conn.Open() cmd.Connection = conn cmd.CommandText = "Delete From bookings where Bk_id = " & CInt(datagridView1.Item(0,datagridView1.CurrentRow.Index).Value.ToString) cmd.ExecuteNonQuery() conn.Close()
All 2 Replies
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.