Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2005
    Posts
    5

    Unanswered: Syntax Error in FROM clause

    Hi,

    I am trying to create a login page. I am not too sure where actually went wrong as i keep getting this error message : Syntax Error in FROM clause. Attach is my program. I seriously need all of your help. I will greatly appreciate your help.

    Thank you.
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2005
    Posts
    362

    Blank

    Have you let blank spaces between words?
    dimis

  3. #3
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    looks like a space is missing.... logging.asp should be
    Code:
    <%
    Dim sql, rs, conn
    
    set conn = Server.CreateObject("ADODB.Connection")
    conn.provider = "Microsoft.Jet.OLEDB.4.0"
    conn.Open(Server.MapPath("Traffic.mdb"))
    
    sql = "Select * from User where username='" & Request.Form("user") & "'"
    sql = sql & " And pwd='" & Request.Form("pwd") & "'"
    
    Set rs = conn.Execute(sql)
    %>
    
    <%if not rs.eof then
    
    	Response.Redirect("category.xhtml")
    else
    	Response.Redirect("login.asp")
    %>
    
    <%
    end if
    rs.close
    set rs=nothing
    conn.close
    %>

  4. #4
    Join Date
    Dec 2005
    Posts
    5

    Display record according to the lastest date

    Thanks alot dimis and Coffee Minion. I am now able to login. I am facing any problem now and i seriously need your help. I am not sure how to display record from the database according to the latest date. I tried using the following code, and it display all the record that contains Jam, arrange according to the date in decending order. Which is not what i want.

    sql = "SELECT * FROM TrafficCon WHERE Condition='Jam' ORDER BY TDate DESC"

    If I only want to display record according to the latest date, how should i do? Attach is my updated database and program.

    Thank you very much for your help.
    Attached Files Attached Files

  5. #5
    Join Date
    Jan 2005
    Posts
    362

    Date

    Quote Originally Posted by ferlina

    sql = "SELECT * FROM TrafficCon WHERE Condition='Jam' ORDER BY TDate DESC"

    If I only want to display record according to the latest date, how should i do? Attach is my updated database and program.

    Thank you very much for your help.
    You have to find the latest date and then to query the database (maybe with the top 1 statetment something like 'select top 1 TDate from TrafficCon ORDER BY TDate DESC')

  6. #6
    Join Date
    Dec 2005
    Posts
    5

    Display record according to the lastest date

    Hi Dimis,

    Thank very much for your help. The solution you provide me works. You are really great hehe...

    Regards,
    Ferlina

  7. #7
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    you could also use something like...
    Code:
    select TDate from TrafficCon where TDate = Max(TDate))
    not sure of that syntax though, you might need
    Code:
    select * from TrafficCon where TDate = (select Max(TDate) from TrafficCon)

Posting Permissions

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