Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2008
    Posts
    4

    Wink Unanswered: 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

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    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
    Home | Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •