ASP technology in WAP (IV.)

Source: Internet
Author: User
Tags ticket
Choose movie theater and release time

This section of code allows the user to choose what time to watch the movie, and all the records are based on the movie selected on the previous page. Here to choose the cinema and the release time.

movie_id = Request ("movie")

sqlquery = "Select title from movie WHERE movie_id =" & movie_id

Set Rsmovie = conn. Execute (SQLQuery)

Movie_title = Rsmovie ("title")

:

sqlquery = "SELECT [Name], [TIME], [show_id] from show, theater" &_

"WHERE show.movie_id =" & movie_id &_

"And theater.theater_id = show.theater_id"

Set rsshows = conn. Execute (SQLQuery)

If you study the code carefully, you will want to use the session to save the movie information, and then the query on this page is simpler. It is also unfortunate that the session is needed
Cookies are supported, although they are also supported in the WAP specification, but are not supported in Nokia 7110, which means that we are not able to use the session in WAP
Services.

Here are some interesting things:

<select name= ' show ' >

<%

Do as not rsshows.eof

Response.Write ("<option value= '" & Rsshows ("show_id") & "' >" & Left (rsshows ("name"), Cutter) & "(" &
Rsshows ("Time") & ")" & "</option>" &vbcrlf)

Rsshows.movenext

Loop%>

</select>

If you're wondering about cutter variables, then there's something that makes you laugh and cry.

Dim Cutter

If InStr (Request.ServerVariables ("Http_user_agent"), "Nokia7110") Then

Cutter = 12

Else

Cutter = 7

End If

This code displays options based on different devices. We have plenty of reasons to do this, Nokia Toolit 1.2 emulators like to cut off my options to only a few words
character, and we have to show the movie name and release time, so we have to reduce the characters of the movie name. This problem does not occur in real phones, so we will
The type of equipment must be judged first.

Once I have the chance (flying knife I am very poor, no money, this is just a distant dream ...) Test my code on real Nokia 7110 and we'll immediately feel that we
There's a bigger screen than we thought. In fact, some cinemas have strange names, and these long names take up a lot of screen space, and we don't need to waste these display empty
, try to simplify these names.

Ticket

The next step is to let the user select the number of votes they want. This part of the code is much like the other parts. I will query the same data from the database because the session cannot be in the real
WAP phone, so I have to confirm some of the content to see if there are any seats for sale.

SQLQuery = "SELECT * from show WHERE show_id =" & show_id

Set rsshow = conn. Execute (SQLQuery)

:

Seats = rsshow ("Free_seats")

:

If seats = 0 Then

Response.Write ("Sorry, no more seats")

Rsshow.close

Set rsshow = Nothing

Response.Write ("</p></card></wml>")

Response.End

Else

If seats > 6 Then ' book up to 6 tickets or Max available

Max_seats=6

Else

Max_seats = seats

End If

End If

%>

<%=movie_title%> at <% =theater_name%>

<select name= ' ticket ' >

<%

Dim i

i = 1

Do While I <= max_seats

Response.Write ("<option value= '" & I & "' >" & I & "Ticket (s)" & "</option>" &vbcrlf)

i = i + 1

Loop%>

</select>

Number of votes stored

Now that we have all the data we need, we have to save them:

Tickets = Request ("Ticket")

:

Free_seats = Rsshow ("Free_seats")

:

Free_seats = Free_seats-tickets

:

Sqlupdate = "UPDATE Show" &_

"SET show.free_seats=" & Free_seats & "" &_

"WHERE show_id=" & show_id

Conn. Execute (Sqlupdate)

sqlquery = "Select Max ([booking_id]) as Bookingnumber from booking"

Set rsbooking = Conn.execute (sqlquery)

Maxbookid = rsbooking ("Bookingnumber") + 1


Sqlinsert = "INSERT into booking (show_id, Booked_seats)" & _

"VALUES (' & show_id &" ', ' "& Tickets &") "

Conn. Execute (Sqlinsert)%>

Have booked <%=tickets%> ticket (s) for <%=movie_title%><br/>

The show would take place at <%=theater_name%> (<%=time%>)

<br/>

Your Reference number is <%=maxbookid%>

Here is the display:

Figure 4: Complete the transaction.

The deal is finished and the cinema can collect money at the cinema gate.

Conclusion

WAP is now just out of its first step, yet it is one of the most revolutionary it developments in recent years. In this article I introduced how to write WAP applications using ASP,
And I have given you some warning, and I hope it will be useful for your future development. Multimedia technology still can not be used for WAP, but its mobility is important, but also for
Business offers a lot of business opportunities.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.