Jump to content

Recommended Posts

Thats your problemchange this to

UPDATE tblseats SET status='',cust_forename='',cust_surname='',cust_book_id='',cust_address='',cust_postcode='',cust_area_code='',cust_tel_number='',cust_cc='',

to

UPDATE tblseats SET status='',cust_forename='',cust_surname='',cust_book_id='',cust_address='',cust_postcode='',cust_area_code='',cust_tel_number='',cust_cc=''

However this will update every record in your table you need to set some conditions like WHERE cust_id='233' or something like that.when you run this be sure to uncomment line 26 so it starts executing again.

Link to post
Share on other sites
if Request.querystring("action")<>"Save" then	  seat=Request.Form("seat")	  'sql="UPDATE tblseats SET status='" & Request.Form("status") & "',"UPDATE tblseats SET status='',cust_forename='',cust_surname='',cust_book_id='',cust_address='',cust_postcode='', cust_area_code='',cust_tel_number='',cust_cc='' WHERE tblseats.seat=" & no 	  sql=sql & "cust_forename='" & Request.Form("cust_forename") & "',"	  sql=sql & "cust_surname='" & Request.Form("cust_surname") & "',"	  sql=sql & "cust_book_id='" & Request.Form("cust_book_id") & "',"	  sql=sql & "cust_address='" & Request.Form("cust_address") & "',"	  sql=sql & "cust_postcode='" & Request.Form("cust_postcode") & "',"	  sql=sql & "cust_area_code='" & Request.Form("cust_area_code") & "',"	  sql=sql & "cust_tel_number='" & Request.Form("cust_tel_number") & "',"	  sql=sql & "cust_cc='" & Request.Form("cust_cc") & "',"	  'sql=sql & "cust_cc='" & now() & "' WHERE tblseats.seat=" & noconn.Execute sql, Recordsaffected

Thats what i am now running and i now get the error:Microsoft VBScript compilation (0x800A0401)Expected end of statement/bookseat_process.asp, line 17, column 16UPDATE tblseats SET status='',cust_forename='',cust_surname='',cust_book_id='',cust_address='',cust_postcode='', cust_area_code='',cust_tel_number='',cust_cc='' WHERE tblseats.seat=" & no---------------^

Link to post
Share on other sites

lolanyways I assume the user is only reserving one seat with this form right???so you want to only update that one seat.Without a WHERE clause your script will reserve EVERY seat.so if you add something like

"UPDATE ....SET.....WHERE seat = '" & Request.Querystring("seat") & "'"

providing the seat querystirng contained the name of the seat like A1 or B7Also assuming that the field 'seat' is the proper name.Do you see what I mean?

Link to post
Share on other sites

they will only be reserving one seat at a time, yes, I did think about adding funcions for reserving a number of seats, but decided against it (mainly cos its more work lol)urmm, i run the form so it now sends me to:http://127.0.0.1/bookseat_process.asp?acti...ave&seat=a1So then it specifys a seat and the action in the query string.The code i updated now looks like:

UPDATE tblseats SET status='',cust_forename='',cust_surname='',cust_book_id='',cust_address='',cust_postcode='',cust_area_code='',cust_tel_number='',cust_cc='' WHERE seat = '" & Request.Querystring("seat") & "'"

I get the error:Microsoft VBScript compilation (0x800A0401)Expected end of statement/bookseat_process.asp, line 17, column 16

Link to post
Share on other sites
<html><head><title>ADO - Submit DataBase Record</title></head><body><h2>Submit to Database</h2><%'on error resume nextset conn=Server.CreateObject("ADODB.Connection") conn.provider="Microsoft.Jet.OLEDB.4.0"conn.open(server.mappath("show1.mdb"))if Request.querystring("action")<>"Save" then	  seat=Request.Form("seat")	  'sql="UPDATE tblseats SET status='" & Request.Form("status") & "',"UPDATE tblseats SET status='',cust_forename='',cust_surname='',cust_book_id='',cust_address='',cust_postcode='',cust_area_code='',cust_tel_number='',cust_cc='' WHERE seat = '" & Request.Querystring("seat") & "'"  	  	  sql=sql & "cust_forename='" & Request.Form("cust_forename") & "',"	  sql=sql & "cust_surname='" & Request.Form("cust_surname") & "',"	  sql=sql & "cust_book_id='" & Request.Form("cust_book_id") & "',"	  sql=sql & "cust_address='" & Request.Form("cust_address") & "',"	  sql=sql & "cust_postcode='" & Request.Form("cust_postcode") & "',"	  sql=sql & "cust_area_code='" & Request.Form("cust_area_code") & "',"	  sql=sql & "cust_tel_number='" & Request.Form("cust_tel_number") & "',"	  sql=sql & "cust_cc='" & Request.Form("cust_cc") & "',"	  'sql=sql & "cust_cc='" & now() & "' WHERE tblseats.seat=" & noconn.Execute sql, RecordsaffectedResponse.Write(sql) if err <> 0 then Response.Write("You do not have permission to update this database!") 'else  'Response.Write("Record number " & no & " was updated.") end if 	  'Response.Redirect("showavail.asp")end if'if Request.Form("action")="Delete" then	  'no=Request.Form("no")' conn.Execute "DELETE FROM tblGuestBook WHERE tblGuestBook.[no]=" & no, Recordsaffected' if err <> 0 then' Response.Write("You do not have permission to delete a record from this database!")' else ' Response.Write("Record number " & no & " was deleted.")' end if 	  'Response.Write("Deleting records has been disabled from this demo")'end ifconn.close%></body></html>

Thats the ENTIRE page

Link to post
Share on other sites

SORTED!I have used a slightly different way and it works fine, the only thing now is the first page that shows the seats, if the seat is booked it still links, is there anyway i can change that?

<html><head><title>Seating Availability</title></head><body><style type="text/css"><!--.style1 {	color: #CCCCCC;	font-family: Verdana, Arial, Helvetica, sans-serif;}body {	margin-top: 0px;}body,td,th {	font-family: Verdana, Arial, Helvetica, sans-serif;}--></style><table width="720" border="0" align="center" cellpadding="0" cellspacing="0">  <tr>	<td bgcolor="#333333"><p> </p>	  <h1 align="center" class="style1">STAGE</h1>	<p align="center" class="style1"> </p></td>  </tr></table><table width="700" border="0" align="center" cellpadding="0" cellspacing="0">  <tr>	<td bgcolor="#333333"> </td>  </tr></table>  <table width="710" height="30" border="0" align="center" cellpadding="0" cellspacing="0">	<tr>	  <td> </td>	</tr>  </table>  <p>	<% Dim adoCon		 'Holds the Database Connection ObjectDim rsShow1Avail   'Holds the recordset for the records in the databaseDim strSQL		  'Holds the SQL query to query the database Set adoCon = Server.CreateObject("ADODB.Connection")adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("show1.mdb")Set rsShow1Avail = Server.CreateObject("ADODB.Recordset")strSQL = "SELECT tblSeats.Seat, tblSeats.Status FROM tblSeats;"rsShow1Avail.Open strSQL, adoConResponse.Write "<table width=700 border=0 align=center>"'While NOT rsShow1Avail.EOF'	If rsShow1Avail("status") = "Booked" Then'		col = "Red"'	Else '		col = "Green"'	End IfWhile NOT rsShow1Avail.EOF 	If sLetter <> Left(rsShow1Avail("seat"), 1) Then 		If sLetter <> "" Then 			Response.Write "</tr>" 		End If 		Response.Write "<tr>" 		sLetter = Left(rsShow1Avail("seat"), 1) 	End If 		If rsShow1Avail("seat") = "A6" Then			Response.Write "<td rowspan=20 width=40></td>"	End If	If rsShow1Avail("status") = "Booked" Then 		col = "Red" 	Else 		col = "Green" 	End If 		Response.Write "<td><table width=80% border=1 align=center><tr><td bgcolor=""" & col & """><div align=center class=style3><font face=verdana><a href=update_form.asp?ID=" & rsShow1Avail("seat") & ">" & rsShow1Avail("Seat") & "</a></font></div></td></tr></table></td>"	rsShow1Avail.Movenext()WendResponse.Write "</tr></table>"rsShow1Avail.CloseSet rs = NothingSet adoCon = Nothing%>	<style type="text/css"><!--body,td,th {	color: #FFFF33;}a:link {	color: #FFFF00;}a:visited {	color: #FFFF00;}a:active {	color: #FFFF00;}-->	</style>	</p></body>

Link to post
Share on other sites

do this

Response.Write "<td><table width=80% border=1 align=center><tr><td bgcolor=""" & col & """><div align=center class=style3><font face=verdana>"If rsShow1Avail("status") <> "Booked" Then  Response.Write "<a href=update_form.asp?ID=" & rsShow1Avail("seat") & ">" & rsShow1Avail("Seat") & "</a>"Else  Response.Write rsShow1Avail("Seat")End IfResponse.Write "</font></div></td></tr></table></td>"

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...