I think your Where clause needs to be something more like.....

WHERE OrderDate like #DateFormat(Now(),'m/dd/yyyy')#

The way you have it written now, the date AND time have to match the exact
minute and second precisely.

Hope this helps some.

By the way this is untested and my CF is a little rusty.


-----Original Message-----
From: Will Tomlinson [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 21, 2006 4:50 PM
To: CF-Talk
Subject: Getting today's orders?

I need to get today's orders in a query. I know there's one test order in
the db today, but I can't get my query to return anything. It's SQL Server,
smalldatetime field. Here's the data in the db: 8/13/2006 6:04:00 PM

What do I do to make this work? 

<cffunction name="getTodayOrders" access="public" returntype="query"
output="false"
         hint="Returns a query of today's orders">
  <cfset var gettodayorders = "">
  <cfquery name="gettodayorders" datasource="#VARIABLES.dsn#">
  SELECT orderID, orderdate, ordersubtotal, ordertotal, cartID,
paymentstatusID,  paypalpaymenttypeID, shiptotal
  FROM tblOrders
  WHERE orderdate =
  <cfqueryparam cfsqltype="cf_sql_timestamp"
value="#CreateODBCDateTime(Now())#">
  ORDER BY orderdate DESC
  </cfquery>
  <cfreturn gettodayorders>
</cffunction>

Thanks,
Will



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250524
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to