Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
exitwithout()
Me.Close()
End Sub
Private Sub exitwithout()
myCommand.Connection = myConnection
myConnection.Open()
myCommand.CommandText = "Select * from orders where o_id= " & txtb1.Text & ""
dr = myCommand.ExecuteReader()
Try
If dr.HasRows Then
deletewithout()
Else
Exit Sub
End If
Catch ex As Exception
MessageBox.Show("Error while Deleting Record..." & ex.Message, "Delete Records")
Finally
myConnection.Close()
End Try
End Sub
Private Sub deletewithout()
Try
Dim intTemp As Integer
intTemp = MsgBox("Are You Sure, You want to Exit Without Purchase ?", MsgBoxStyle.YesNo)
If intTemp = 6 Then
myConnection.Open()
myCommand.Connection = myConnection
myCommand.CommandText = "delete from orders where o_id = " & txtb1.Text & ""
i = myCommand.ExecuteNonQuery()
If i > 0 Then
myConnection.Close()
MessageBox.Show("Order Cancelled Successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
Else
Exit Sub
End If
Catch ex As Exception
MessageBox.Show("Error while Deleting Record..." & ex.Message, "Delete Records")
Finally
myConnection.Close()
End Try
End Sub
rick.eavans
0
Newbie Poster
Recommended Answers
Jump to PostConnection will be busy till dataReader is not closed.
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click exitwithout() Me.Close() End Sub Private Sub exitwithout() myCommand.Connection = myConnection myConnection.Open() myCommand.CommandText = "Select * from orders where o_id= " & val(txtb1.Text) dr = myCommand.ExecuteReader() Dim …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.