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 > Syntax Error in FROM clause

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-27-05, 04:18
ferlina ferlina is offline
Registered User
 
Join Date: Dec 2005
Posts: 5
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
File Type: zip IT3825 (login).zip (16.9 KB, 90 views)
Reply With Quote
  #2 (permalink)  
Old 12-27-05, 05:57
dimis2500 dimis2500 is offline
Registered User
 
Join Date: Jan 2005
Posts: 362
Blank

Have you let blank spaces between words?
dimis
Reply With Quote
  #3 (permalink)  
Old 12-27-05, 22:21
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
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
%>
Reply With Quote
  #4 (permalink)  
Old 12-29-05, 04:22
ferlina ferlina is offline
Registered User
 
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
File Type: zip Traffic.zip (18.5 KB, 16 views)
Reply With Quote
  #5 (permalink)  
Old 12-29-05, 04:52
dimis2500 dimis2500 is offline
Registered User
 
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')
Reply With Quote
  #6 (permalink)  
Old 12-29-05, 14:07
ferlina ferlina is offline
Registered User
 
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
Reply With Quote
  #7 (permalink)  
Old 12-29-05, 17:51
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
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)
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