Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 15th, 2004, 09:48 AM
Registered User
 
Join Date: Apr 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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>



Reply With Quote
  #2 (permalink)  
Old April 15th, 2004, 09:53 AM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

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

<><
Reply With Quote
  #3 (permalink)  
Old April 20th, 2004, 07:28 AM
Authorized User
 
Join Date: Aug 2003
Location: woking, surrey, United Kingdom.
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Just guessing here but though I don't know what your tables look like should patients.Firs_Name be Patients.First_Name. ??


Reply With Quote
  #4 (permalink)  
Old April 22nd, 2004, 05:33 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

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
Reply With Quote
  #5 (permalink)  
Old April 26th, 2004, 02:19 PM
Registered User
 
Join Date: Apr 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your posts. I have managed to get rid off that error.

Thanks for your posts.



Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 04:57 PM.


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