Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date format 2

Status
Not open for further replies.

achai

MIS
May 23, 2000
71
US
file1:<br>&lt;form action=&quot;file2.cfm&quot; method&quot;post&quot;&gt;<br>&lt;input type=&quot;text&quot; name=&quot;date&quot;&gt; deadline date<br>&lt;input type=&quot;submit&quot; value=&quot;submit&quot;&gt;<br>&lt;/form&gt;<br>---------<br>file2:<br>&lt;cfquery name=&quot;finddate&quot; datasource=&quot;abcd&quot;&gt;<br>select *<br>from tablename<br><b>where 'tablename.deadline' &gt; '#date#'</b><br>order by deadline<br>&lt;/cfquery&gt;<br>--------<br>problem is tablename.deadline is date format.<br>no matter what i input in file1 form, then search to file2, query result is to give me whole database ignoring &quot;<b>where 'tablename.deadline' &gt; '#date#'</b> &quot;.<br>when i change &gt; to &lt;, no matter what i type in form, the result is nothing.<br>i change input date format, like yyyy-mm-dd, mm/dd/yyyy, mon-dd-yyyy. result is same, give me the whole database order by deadline ignoring &quot;<b>where 'tablename.deadline' &gt; '#date#' </b>&quot;.<br><br>
 
Try changing it to:<br><br><b>where tablename.deadline &gt; '#date#'</b> (no single quotes)<br><br>Since this is a column, you should not use the quotes around it.&nbsp;&nbsp;Your query is treating it like a string value.<br><br>Let me know if this works...
 
unfortunately. it shows erro, when i delete the <b>'</b> <b>'</b> covering data.deadline.<br>---------------<br>Error Diagnostic Information<br>ODBC Error Code = 22005 (Error in assignment)<br><br>[Microsoft][ODBC Microsoft Access 97 Driver] Data type mismatch in criteria expression.<br><br>The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (16:1) to (16:62).<br><br>
 
hhhhhhmmmmmmm..........<br><br>Try this...<br><br>where tablename.deadline &gt; #date# (take quotes off #date#)<br><br>and if this doesn't work:<br><br>where tablename.deadline &gt; ###date###&nbsp;&nbsp;(access help shows dates surrounded by pound signs.&nbsp;&nbsp;Use the double pound signs to escape them in CF, plus the pound signs that surround the variable name...)<br><br>Let me know if one of these work, and if so, which one (or both, maybe?)..:)<br><br>DM
 
both work.<br>but results are still to give me whole database ignoring &quot;where 'tablename.deadline' &gt; #date# &quot;.<br>I'm wondering if system knows 2009-03-04 is greater than 2000-03-04.<br><br>
 
it should... But it looks like you put the single quotes back around tablename.deadline.&nbsp;&nbsp;Those need to come off if you want it to compare it as a column and not a string value....<br><br>Here's a query I just put together from an access 97 database I have using the query builder...<br><br><FONT FACE=monospace>SELECT Client.*<br>FROM Client<br>WHERE (((Client.Date)&gt;#4/1/2000#));</font><br><br>This query in CF should look like this:<br><br><FONT FACE=monospace>SELECT Client.*<br>FROM Client<br>WHERE (((Client.Date)&gt;###4/1/2000###));</font>
 
that's great! now it works.<br>use <b>(</b><b>)</b> instead of <b>'</b><b>'</b>.<br>thanks.<br>btw, don't use <b>;</b> in the end of &quot;where&quot; sentense. it will show erro in cfquery.<br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top