 |
|
มีการเช็คค่าจาก db แล้วเอามา
Code (VB.NET)
If dt.Rows.Count <> 0 Then
Me.ClientScript.RegisterStartupScript(Me.GetType, "", "alert('Seat no." & Session("seat") & " booked. Please select seat no. again');location.href='AirBusMenu.aspx';", True)
'Session.Remove("seat")
'txtSeat.Value = ""
Exit Sub
Else 'If dt.Rows.Count = 0 Then
InsertData(CnInsert)
InsertSeat(CnSeat)
Me.ClientScript.RegisterStartupScript(Me.GetType, "", "alert('Booking complete K." & Session("name") & " at seat no." & Session("seat") & "');location.href='AirBusMenu.aspx';", True)
Exit Sub
End If
พอเสร้จแล้ว ค่ามันวนไปเช็คอีกรอบ จะมีวิธีดักยังไงคะไม่ให้มันกลับไปเช้ค If ซ้ำน่ะค่ะ
code ทั้งหมดค่ะ
Code (VB.NET)
Dim StrsqlChk As String
Dim CnChk As New OleDb.OleDbConnection(StrConn)
CnChk.Open()
StrsqlChk = ""
'---- Sql statement ----
'Session("UserId") = Session("UserId").toUpper
StrsqlChk = "SELECT A2STPT FROM WEBAPPD.ABK020P WHERE A2STPT = '" & Session("Seat") & "' AND A2EMNO <> ''"
'---- End Sql statement ----
Dim DA As New OleDbDataAdapter(StrsqlChk, CnChk)
Dim dt As New DataTable()
DA.Fill(dt)
If dt.Rows.Count <> 0 Then
Me.ClientScript.RegisterStartupScript(Me.GetType, "", "alert('Seat no." & Session("seat") & " booked. Please select seat no. again');location.href='AirBusMenu.aspx';", True)
'Session.Remove("seat")
'txtSeat.Value = ""
Exit Sub
Else 'If dt.Rows.Count = 0 Then
InsertData(CnInsert)
InsertSeat(CnSeat)
Me.ClientScript.RegisterStartupScript(Me.GetType, "", "alert('Booking complete K." & Session("name") & " at seat no." & Session("seat") & "');location.href='AirBusMenu.aspx';", True)
Exit Sub
End If
CnChk.Close()
Tag : .NET, Web (ASP.NET), VB.NET
|
|
 |
 |
 |
 |
Date :
2012-08-22 09:24:54 |
By :
BKAJU1987 |
View :
1040 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |