EasyCFM.COM ColdFusion Forums / MS Access Related Issues / Access error

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Access error

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

CaliforniaSteve
07-11-2008 @ 6:08 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Junior Member
Posts: 60
Joined: Dec 2002

I have a site that has been running on coldfusion 7 for the 4 years without problem. On Monday the DSN stopped working< fixed that today now I'm getting this error. The site is on readyhosting's servers if you are familar with them.

Error Executing Database Query.  
DATEDIFF('n',lastlogin,2008-07-11 18:51:25.0) has an error parameters list  
  
The error occurred in \\nawinfs02\home\users\web\b387\rh.californiasteve\includes\queries\qry_getmembers.cfm: line 28
Called from \\nawinfs02\home\users\web\b387\rh.californiasteve\index.cfm: line 240
Called from 'n',lastlogin,2008-07-11 18:51: line -1
Called from \\nawinfs02\home\users\web\b387\rh.californiasteve\includes\queries\qry_getmembers.cfm: line 28
Called from \\nawinfs02\home\users\web\b387\rh.californiasteve\index.cfm: line 240

26 :                     </cfif>
27 :                ) AS loggedmem,
28 :           (select Count(messageid) from messages where messagedate > #Session.UsersLastVisit#) as newmessages,
29 :           (select Avg(posts) from members) as averageposts,
30 :           (select Count(topicid) from topics) as totaltopics,



--------------------------------------------------------------------------------

SQL    Select memberid,username,joindate, (select count(memberid) from members where 1 = 1 AND datediff('n',lastlogin,{ts '2008-07-11 18:51:25'}) < 15 ) AS loggedmem, (select Count(messageid) from messages where messagedate > {ts '2008-07-11 18:51:24'}) as newmessages, (select Avg(posts) from members) as averageposts, (select Count(topicid) from topics) as totaltopics, (select Count(messageid) from messages) as totalmessages, (select sitehitcounts from forumvariables) as sitehits, (select counterstartdate from forumvariables) as counterstartdate, (select Count(memberid) from members) as totalmembers from members group by memberid, username, joindate order by joindate DESC  
DATASOURCE   MY_DSN
VENDORERRORCODE   139299
SQLSTATE    



weathermanfsu
06-09-2009 @ 12:28 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 183
Joined: Apr 2004

Access likes # signs around dates.  Well we know what CF does with # signs...    What we have to do is use a double # sign on both sides of your variable and then one more pound sign so it will know it is a variable....  Double # signs back to back will display a # sign in the output either to the database or the user...

###Session.UsersLastVisit###

This will make it where the query sees #6/9/2009 12:19PM#, which is what access wants to see.

The way you were doing it, the query was seeing where date > 6/6/09 12:06 PM with no quotes and no pound signs.

This message was edited by weathermanfsu on 6-9-09 @ 12:30 PM


Website Designed and Developed by Pablo Varando.