 |
| 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
|
|
|
|

April 15th, 2004, 09:48 AM
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
syntax error
Can anyone help me sort this out. the error points to the last line of this part of the code
Set Myconn = Server.CreateObject("ADODB.Connection")
MdbFilepath = Server.MapPath("surgery.mdb")
MyConn.Open "Driver={Microsoft Access Driver (*.mdb) };DBQ= "&
MdbFilePath & ";"
I am searching a matching surname. There is syntax error and i cant find where it i.
<BASEFONT FACE="tahoma" color="green">
<html>
<title>
Online Appointment Booking and reminder system
</title>
<head>
<body bgcolor="blue"> <link rel="stylesheet" type="text/css" href="style.css"
<center> <h1>Appointment Booking System</h1> </CENTER> </head>
<%
'declaring and using values from the form patientlist.asp
dim Lname
dim status
Lname = Request.form("L_name")
status = Request.form("radio1")
'connect to the database
Set Myconn = Server.CreateObject("ADODB.Connection")
MdbFilepath = Server.MapPath("surgery.mdb")
MyConn.Open "Driver={Microsoft Access Driver (*.mdb) };DBQ= "&
MdbFilePath & ";"
' Open a recordset
set rs = server.CreateObject ("ADODB.Recordset")
rs.Open "SELECT patients.Title, patients.Firs_Name, patients.Last_Name, patients.LoginID FROM patients WHERE(((patients.Last_Name)='"+Lname+"'));",
Myconn,
1
' Testing condition to check the kind of operation that is taking place
' Check that the value taken from the radio exist
' If there is no value generate error message
if status = "" then ' looks to check if value has been chosen
response.write("<h2> Please Choose an option from the radio list, Click <A HREF='patientlist.asp'> Here </A> to go back <h2>")
else 'looks to see if an option has been selected then check is carried out to make sure that the name is in the database
if Lname = "" then
response.write("<h2> Please enter a patient name in the search field </h2>")
else
'if the name is 0 then the last name doesnt exist within the database then error is generated
if rs.recordcount = 0 then
%><H2> There are no patient with <%response.write(Lname)%> for their Last Name: <br> <br> Please Click
<A HREF=patientlist> Here </A> To try another Last Name:</h2><%
RS.close
Myconn.close
set RS=nothing
set Myconn=nothing
else
if status = "Book" then
%> The patient with the last name,
<%=response.write(Lname)%> are:<br><br><%
WHILE NOT rs.EOF
'loop through the patients that match and display each one.
%>
<%rs("Title")&" "%><%=rs("Firs_Name")&" "%><A HREF="surgery_clander.asp"?id=<%=rs("LoginID")%>&e mp=
<%=Request.form("empdid")%>"><%=rs("Las_Name")%> </A><%=" "&rs("DOB")&" "%><br>
<%
rs.MoveNext
WEND 'end loop
RS.close
Myconn.close
set RS=nothing
set Myconn=nothing
end if
if status = "Cancel" then
%> The patient with the last name,
<%=response.write(Lname)%> are:<br><br><%
WHILE NOT rs.EOF
'loop through the patients that match and display each one.
%>
<%rs("Title")&" "%><%=rs("Firs_Name")&" "%><A HREF="surgery_clander.asp"?id=<%=rs("LoginID")%>&e mp=
<%=Request.form("empdid")%>"><%=rs("Las_Name")%> </A><%=" "&rs("DOB")&" "%><br>
<%
rs.MoveNext
WEND 'end loop
RS.close
Myconn.close
set RS=nothing
set Myconn=nothing
end if
if status = "Update" then
%> The patient with the last name,
<%=response.write(Lname)%> are:<br><br><%
WHILE NOT rs.EOF
'loop through the patients that match and display each one.
%>
<%rs("Title")&" "%><%=rs("Firs_Name")&" "%><A HREF="surgeryclander.asp"?id=<%=rs("LoginID")%>&em p=
<%=Request.form("empdid")%>"><%=rs("Las_Name")%> </A><%=" "&rs("DOB")&" "%><br>
<%
rs.MoveNext
WEND 'end loop
RS.close
Myconn.close
set RS=nothing
set Myconn=nothing
end if
end if
end if
end if
%>
</body>
|
|

April 15th, 2004, 09:53 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
I'm not sure this is your error (I'm not even sure it is an error, I don't know ASP very well), but at one point near the end you have this line:
<%rs("Title")&" "%>
Shouldn't this be:
<%=rs("Title")&" "%>
?
Hope this helps,
Snib
<><
|
|

April 20th, 2004, 07:28 AM
|
|
Authorized User
|
|
Join Date: Aug 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Just guessing here but though I don't know what your tables look like should patients.Firs_Name be Patients.First_Name. ??
|
|

April 22nd, 2004, 05:33 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
It would be better if you post the exact error that you are getting, along with the line number.
Till then you could only expect guesses;) not the solution.
-Vijay G
|
|

April 26th, 2004, 02:19 PM
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for your posts. I have managed to get rid off that error.
Thanks for your posts.
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Parse error: syntax error, unexpected T_ELSE in /h |
vipin k varghese |
BOOK: XSLT Programmer's Reference, 2nd Edition |
4 |
September 29th, 2011 01:19 AM |
| Ch 4: Parse error: syntax error, unexpected T_SL |
hanizar77 |
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 |
0 |
June 23rd, 2008 09:17 PM |
| Parse error: syntax error, unexpected T_STRING |
ginost7 |
Beginning PHP |
1 |
November 9th, 2007 02:51 AM |
| VB Error: Syntax Error or Access Violation |
codehappy |
VB How-To |
7 |
October 3rd, 2007 05:41 PM |
| Compile error: Syntax error: & Else without HELP |
Corey |
VB How-To |
2 |
April 21st, 2006 03:25 PM |
|
 |