If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > help?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-21-04, 23:43
Max30 Max30 is offline
Registered User
 
Join Date: May 2004
Posts: 6
help?

Hello there !!

I have Create this page which will receive the staffID from form page. Based on that information it should extract the unitIDs, names and semesters of all units coordinated by this staff member and display in a table


But When i run it i get this

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'coordination.staffID = and unit.unitID = coordination.unitID and coordination.staffID = staff.staffID'

If anyone could help me with this?

Thanx for your time.


<%@ Language="VBScript" %>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<% set myConnection=server.createobject("ADODB.connection ")
myConnection.open "Outline", "IWSDStudent", "assign2"
sID = request.form("staffID") 'retrieve the StaffID
'use the Staff ID to retrieve the info from the db
mySQL = "select coordination.unitID, unit.unitname, "
mySQL = mySQL & "coordination.semester from unit, staff, coordination"
mySQL = mySQL & " where coordination.staffID = " & sID & " and "
mySQL = mySQL & "unit.unitID=coordination.unitID and "
mySQL = mySQL & "coordination.staffID =staff.staffID"
set myRS = myConnection.execute(mySQL)
%>
<body>
<h2>Units coordinated by: <%=sID%></h2>
<table border="1" summary="Coordination details">
<tr><td>Unit ID</td><td>Unit Name</td><td>Semester</td></tr>
<%
do while not myRS.eof
%>
<tr><td><%= myRS ("unitID")%></td>
<td><%= myRS ("unitname")%></td>
<td><%= myRS ("semester")%></td>
</tr>
<%
myRS.movenext
loop
%>
</table>
<br /><p><a href="ex8.htm">Return to the form</a></p>
</body>
</html>
Reply With Quote
  #2 (permalink)  
Old 05-22-04, 16:46
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
Quote:
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'coordination.staffID = and unit.unitID = coordination.unitID and coordination.staffID = staff.staffID'
The answer is in the error...

...coordination.staffID = and...

There is no value between the "=" and the "and"... so look back in your code where this line is:

mySQL = mySQL & " where coordination.staffID = " & sID & " and "

So the value that should be between the "=" and the "and" is from sID. For some reason sID is blank. So look for where you set the value of sID:

sID = request.form("staffID") 'retrieve the StaffID

Ok, so you're getting it from a form... now you need to look back on the form that you submit and make sure "staffID" is in fact passing a value.
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #3 (permalink)  
Old 05-23-04, 08:33
Max30 Max30 is offline
Registered User
 
Join Date: May 2004
Posts: 6
Thanx !

I have solve that with your help, again thanx.
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On