Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
Dim sql As String
Private Sub Command1_Click()
sql = "select * from trainres where pnr=" & Text1.Text
If rs.State = 1 Then
rs.Close
End If
rs.Open sql, con, adOpenDynamic, adLockOptimistic
If (Not rs.EOF) Then
tcount = rs.Fields("trainno")
If (rs.Fields("status") = "Wait Listed") Then
rs.Delete
MsgBox "Ticket Cancelled"
rs.Close
Else
sql = "select * from trainres where status='Wait Listed' and trainno=" & tcount & "and doj in(select doj from trainres where pnr=" & Text1.Text & ")"
If rs1.State = 1 Then
rs1.Close
End If
rs1.Open sql, con, adOpenDynamic, adLockOptimistic
If rs.Fields("doj") < Form2.DTPicker1.Value Then
MsgBox "YOUR DATE HAS EXPIRED"
Text1.SetFocus
Text1.Text = ""
Else
If (Not rs1.EOF) Then
rs1.Fields("status") = "Reserved"
rs1.Update
rs1.Close
rs.Delete
rs.Close
MsgBox "Ticket Cancelled"
End If
End If
End If
End If
End Sub
Private Sub Form_Load()
con.Open "tr"
Text1.Text = ""
End Sub
Private Sub Form_Unload(Cancel As Integer)
con.Close
End Sub
Railway reservation ProjectError in cancellation form
Page 1 of 1
1 Replies - 4246 Views - Last Post: 15 October 2009 - 06:06 PM
#1
Railway reservation Project
Posted 15 October 2009 - 07:45 AM
I am doing online railway reservation project in VB. In the cancellation form, i am encountering one problem. Here if we click cancel button for expired date no msg is displaying.
Replies To: Railway reservation Project
#2
Re: Railway reservation Project
Posted 15 October 2009 - 06:06 PM
Try:
Good luck!
Edit: I didn't notice there was two!
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
Dim sql As String
Private Sub Command1_Click()
sql = "select * from trainres where pnr=" & Text1.Text
If rs.State = 1 Then
rs.Close
End If
rs.Open sql, con, adOpenDynamic, adLockOptimistic
If (Not rs.EOF) Then
tcount = rs.Fields("trainno")
If (rs.Fields("status") = "Wait Listed") Then
rs.Delete
ans = MsgBox ("Ticket Cancelled", vbOkOnly, "Ticket Cancellled")
rs.Close
Else
sql = "select * from trainres where status='Wait Listed' and trainno=" & tcount & "and doj in(select doj from trainres where pnr=" & Text1.Text & ")"
If rs1.State = 1 Then
rs1.Close
End If
rs1.Open sql, con, adOpenDynamic, adLockOptimistic
If rs.Fields("doj") < Form2.DTPicker1.Value Then
MsgBox "YOUR DATE HAS EXPIRED"
Text1.SetFocus
Text1.Text = ""
Else
If (Not rs1.EOF) Then
rs1.Fields("status") = "Reserved"
rs1.Update
rs1.Close
rs.Delete
rs.Close
Dim ans As vbMsgBoxResult
ans = MsgBox ("Ticket Cancelled", vbOkOnly, "Ticket Cancellled")
End If
End If
End If
End If
End Sub
Private Sub Form_Load()
con.Open "tr"
Text1.Text = ""
End Sub
Private Sub Form_Unload(Cancel As Integer)
con.Close
End Sub
Good luck!
Edit: I didn't notice there was two!
This post has been edited by paperclipmuffin: 15 October 2009 - 06:08 PM
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|