The technology of ASP in WAP six

Source: Internet
Author: User
Tags ticket

The ASP technology in WAP

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 requires the support of cookies, although it is also supported in the WAP specification, but is 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, the Nokia toolit 1.2 emulator likes to cut off my options to only a few characters, and we want to show the movie name and release time so we have to reduce the character of the movie name. This is not a problem in a real cell phone, so we have to determine the type of device first.

Once I have the chance (flying knife I am very poor, no money, this is just a distant dream ...) Testing my code on real Nokia 7110, we immediately feel we have a bigger screen than we think. In fact, some cinemas have strange names, and these long names take up a lot of screen space, and we don't have to waste the display space and try to simplify those 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 used on a real WAP phone, so I have to confirm some of the contents to see if there are any seats to sell.

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 >" &vbcr Lf

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'll 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 gave you some warning, hoping to be useful for your future development. Multimedia technology is still not too much for WAP, but its mobility is important, but also for businesses to provide 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.