Quantcast
Channel: Adobe Community: Message List - ColdFusion
Viewing all articles
Browse latest Browse all 21760

Re: Is using current date and dateAdd the best way to show 30 days worth of records .

$
0
0

Uggghhh.  MSAccess SQL may require wrapping your dates in pound signs (#) (I don't have the ODBC services installed on my machine to test this out).  If it does require the pound signs, you have to double them up to escape them from being used as ColdFusion variable outputs.  So I think your query would look like this (again, I can't test this to verify):

 

SELECT mob_id, display_date, title, scripture, body

FROM devotional

WHERE display_date BETWEEN ##<cfqueryparam value ="#mydatetime#" cfsqltype="cf_sql_date">## AND ##<cfqueryparam value="#DateAdd( 'd', 30, mydatetime )#" cfsqltype="cf_sql_date">##

 

If that doesn't work, try this instead:

 

SELECT mob_id, display_date, title, scripture, body

FROM devotional

WHERE display_date BETWEEN ###CreateODBCDate( mydatetime )### AND ###CreateODBCDate( DateAdd( 'd', 30, mydatetime ) )###

 

 

-Carl V.


Viewing all articles
Browse latest Browse all 21760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>