Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 3rd, 2006, 06:06 PM
Registered User
 
Join Date: Aug 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default updating database

I am trying to update a database, and i am getting the following error:

Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/bookseat_process.asp, line 25, column 16
UPDATE tblseats SET status='',cust_forename='',cust_surname='',cust_bo ok_id='',cust_address='',cust_postcode='',cust_are a_code='',cust_tel_number='',cust_cc='' WHERE seat = '" & Request.Querystring("seat") & "'

here is the full script for the page:
Code:
<html>
<head>
<title>ADO - Submit DataBase Record</title>
</head>
<body>
<h2>Submit to Database</h2>

<%
'on error resume next
set 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=" & no
conn.Execute sql, Recordsaffected
Response.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 if

conn.close%>

</body>
</html>
 
Old August 17th, 2006, 12:23 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Hi,

 sql=sql & "cust_cc='" & Request.Form("cust_cc") & "',"
If below line is commented then above line should be
 sql=sql & "cust_cc='" & Request.Form("cust_cc") & "'"

If this line is not commented,
 'sql=sql & "cust_cc='" & now() & "' WHERE tblseats.seat=" & no
then there is no value in "no" above.
It should be
 'sql=sql & "cust_cc='" & now() & "' WHERE tblseats.seat= '" & no & "'"

Hope this helps



Om Prakash





Similar Threads
Thread Thread Starter Forum Replies Last Post
database not updating ellie BOOK: Beginning ASP 3.0 1 April 16th, 2006 05:28 AM
Help for Updating the database bspradeep Classic ASP Databases 1 May 10th, 2005 03:13 AM
updating database texasraven ASP.NET 1.x and 2.0 Application Design 2 September 21st, 2004 05:14 PM
Updating a database Gary_M Classic ASP Databases 4 November 7th, 2003 11:03 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.