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 > Need help with SQL statement and ASP

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-18-08, 10:32
mazkaf mazkaf is offline
Registered User
 
Join Date: Feb 2008
Posts: 4
Wink Need help with SQL statement and ASP

Hi all

Was hoping someone could shed some light on this

I am running a website for job recruitment. I want the recruiter to be able to view the applications that are sitting in an 'application' table in my db.

To make it clear here are my tables

JobSeeker
JobRecruiter
Application
Jobs

I have a text box which he puts in say his Company name and it looks and mathces it in the Jobs table. I then want this to match his RecruiterID(on my site the users do not know their autonumber ID)in the 'Jobs'table as well. Then do a join to the RecruiterID in the 'Application' table which then i would like everything to then be displayed in the 'Application' as long as its the match to the recruiter. I keep getting the folliwng...........................

Microsoft][ODBC Microsoft Access Driver] The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect.

/mkafar/JobRecruiters/posted_applications-jr.asp, line 59

Below is the asp with the sql which was done in access. Im having trouble and just cant get it right.

Any suggestions please

<%
Set conn = Server.CreateObject("ADODB.Connection")
conn.Mode = adModeReadWrite
conn.open "driver={Microsoft Access Driver (*.mdb)};" & _
"dbq=" & Server.MapPath("../db/job_system2V9.MDB")

user_posted_applications= Request.Form("user_posted_applications")

sql = "SELECT FROM Jobs WHERE Company='" & user_posted_applications & " AND Jobs.RecruiterID AS Jobs_RecruiterID, Application.RecruiterID AS Application_RecruiterID, Application.ApplicationID, Application.SeekerName, Application.SeekerSurname, Application.DateofBirth, Application.SeekerID, Application.Qualifications, Application.PreviousEmployer, Application.Reference, Application.[Reference Telephone], Application.[Personal Description], Application.[Contact Email], Application.JobID FROM Jobs INNER JOIN Application ON Jobs.JobID = Application.JobID;"
Set RS = Server.CreateObject ("ADODB.Recordset")
RS.Open sql, conn, 3, 3

do until RS.EOF
for each x in RS.Fields
Response.Write(x.name)
Response.Write(" = ")
Response.Write(x.value & "<br />")
next
Response.Write("<br />")
RS.MoveNext
loop

rs.close
conn.close
%>

Will be ever so gratefull if someone could help
Reply With Quote
  #2 (permalink)  
Old 03-19-08, 06:05
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
You're not selecting any columns
Quote:
Originally Posted by mazkaf
SELECT FROM
And you can't alias in your WHERE clause
Quote:
Originally Posted by mazkaf
AND Jobs.RecruiterID AS Jobs_RecruiterID
Your SQL statement format should be something along the lines of
Code:
SELECT col1, col2, col3, ... , colN
FROM   tableName
WHERE  someField = SomeValue
For more information see www.w3schools.com/sql
__________________
George
Twitter | Blog
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