createodbcdatetime change in cf9?
Hi, im stuck on a problem that i just cannot seem to figure out. I have a script that recieves popsts from the paypal IPN. This is my code for decoding the date/time: cfif isdefined(form.payment_date) cfset payment_date=urldecode(form.payment_date) cfset dl = len(payment_date) cfset cut = dl - 3 cfset paymentdate_temp=removechars(payment_date,cut,4) cfset paymentdate = #createodbcdatetime(paymentdate_temp)# /cfif The script works fine in CF7 and 8 but kicks an error in CF9. I use cfcatch to snag the error. The error is this: Error at decoding the payment_date, Expression, , 08:38:49 Apr 11, 2012 is an invalid date or time string. I cannot figure out what to do to save my live. Can someone please help? Thanks Tony ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350664 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: createodbcdatetime change in cf9?
Tony, which line does that error occur on ? the error doesn't really make sense with the code supplied as the only line where you are doing anything with payment_date is cfset payment_date=urldecode(form.payment_date) and this is not doing anything date/time related. Are you sure this error is not occuring elsewhere or that you are referencing payment_date somewhere rather than paymentdate_temp On Wed, Apr 11, 2012 at 5:19 PM, Tony Paolillo tpaoli...@gmail.com wrote: Hi, im stuck on a problem that i just cannot seem to figure out. I have a script that recieves popsts from the paypal IPN. This is my code for decoding the date/time: cfif isdefined(form.payment_date) cfset payment_date=urldecode(form.payment_date) cfset dl = len(payment_date) cfset cut = dl - 3 cfset paymentdate_temp=removechars(payment_date,cut,4) cfset paymentdate = #createodbcdatetime(paymentdate_temp)# /cfif The script works fine in CF7 and 8 but kicks an error in CF9. I use cfcatch to snag the error. The error is this: Error at decoding the payment_date, Expression, , 08:38:49 Apr 11, 2012 is an invalid date or time string. I cannot figure out what to do to save my live. Can someone please help? Thanks Tony ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350665 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: createodbcdatetime change in cf9?
I saw the same thing Russ saw in your code. The variable payment_date and paymentdate are named similarly, but are not the same. The error appears to be thrown on payment_date, which doesn't appear to interact with createodbcdatetime() in your example code at all. -Cameron On Wed, Apr 11, 2012 at 12:19 PM, Tony Paolillo tpaoli...@gmail.com wrote: Hi, im stuck on a problem that i just cannot seem to figure out. I have a script that recieves popsts from the paypal IPN. This is my code for decoding the date/time: cfif isdefined(form.payment_date) cfset payment_date=urldecode(form.payment_date) cfset dl = len(payment_date) cfset cut = dl - 3 cfset paymentdate_temp=removechars(payment_date,cut,4) cfset paymentdate = #createodbcdatetime(paymentdate_temp)# /cfif The script works fine in CF7 and 8 but kicks an error in CF9. I use cfcatch to snag the error. The error is this: Error at decoding the payment_date, Expression, , 08:38:49 Apr 11, 2012 is an invalid date or time string. I cannot figure out what to do to save my live. Can someone please help? Thanks Tony ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350669 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: createodbcdatetime change in cf9?
Are you using CFFORM? I never use it, but I kind of remember there is something special witf input fields containing _date. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350671 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: createodbcdatetime change in cf9?
Tony, which line does that error occur on ? the error doesn't really make sense with the code supplied as the only line where you are doing anything with payment_date is cfset payment_date=urldecode(form.payment_date) and this is not doing anything date/time related. Are you sure this error is not occuring elsewhere or that you are referencing payment_date somewhere rather than paymentdate_temp The error occors on the line with createodbcdatetime. I added in a cffile to write soemthing to a file at each line for me to trace where the error occored and it made it all the way to the createodbcdatetime line and then kicked the error.. It doesent make sense to me why on CF9 but not any previous versions. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350672 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: createodbcdatetime change in cf9?
Are you using CFFORM? I never use it, but I kind of remember there is something special witf input fields containing _date. The data is actually being posted back from paypal. Paypal posts to my page with all the transaction vars and i parse them. The script was created by a much more advanced coder than myself and i cant seem to find the problem now. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350673 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: createodbcdatetime change in cf9?
The data is actually being posted back from paypal. Ok, I see. Well the problem is that CF is not able to parse the date in the format supplied by Paypal. Personally, I use createODBCDateTime(Now()) to register the date time. It will be the time related to your sever instead of Paypal's one, but it should be accurate enough. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350674 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: createodbcdatetime change in cf9?
turn on FULL debug output in your cfadmin and it should give you more detail as well as exact line number for the error, in fact a try/catch will do this also. no create a page with a form that posts the exact same data as paypal, and you can use this to debug rather than waiting for paypal. On Wed, Apr 11, 2012 at 6:41 PM, wrote: The data is actually being posted back from paypal. Ok, I see. Well the problem is that CF is not able to parse the date in the format supplied by Paypal. Personally, I use createODBCDateTime(Now()) to register the date time. It will be the time related to your sever instead of Paypal's one, but it should be accurate enough. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350675 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: createodbcdatetime change in cf9?
turn on FULL debug output in your cfadmin and it should give you more detail as well as exact line number for the error, in fact a try/catch will do this also. no create a page with a form that posts the exact same data as paypal, and you can use this to debug rather than waiting for paypal. On Wed, Apr 11, 2012 at 6:41 PM, wrote: Actually, this is the error from cftry/cfcatch: Error at decoding the payment_date, Expression, , 08:38:49 Apr 11, 2012 is an invalid date or time string. I did create a local script and recieved the same error, then i removed the time from the paypal post string and it worked. What i dont understand is why does it work on CF8 and not CF9. Also, lets say i can remove the time from the post, how can i do that? which line? I tried createodbcdate and still got the same error. Thanks ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350677 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: createodbcdatetime change in cf9?
The data is actually being posted back from paypal. Ok, I see. Well the problem is that CF is not able to parse the date in the format supplied by Paypal. Personally, I use createODBCDateTime(Now()) to register the date time. It will be the time related to your sever instead of Paypal's one, but it should be accurate enough. Ill try that also.. thanks ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350678 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: createodbcdatetime change in cf9?
What is the actual content of the form.payment_date coming from PayPal? It should be something like '08:38:49 Apr 11, 2012 PDT'. The code below works just fine on that value on CF9 in my testing environment. Without the ' PDT' part, the code tries to run createodbcdatetime() on '08:38:49 Apr 11, ', which fails. On Wed, Apr 11, 2012 at 11:19 AM, Tony Paolillo tpaoli...@gmail.com wrote: Hi, im stuck on a problem that i just cannot seem to figure out. I have a script that recieves popsts from the paypal IPN. This is my code for decoding the date/time: cfif isdefined(form.payment_date) cfset payment_date=urldecode(form.payment_date) cfset dl = len(payment_date) cfset cut = dl - 3 cfset paymentdate_temp=removechars(payment_date,cut,4) cfset paymentdate = #createodbcdatetime(paymentdate_temp)# /cfif The script works fine in CF7 and 8 but kicks an error in CF9. I use cfcatch to snag the error. The error is this: Error at decoding the payment_date, Expression, , 08:38:49 Apr 11, 2012 is an invalid date or time string. I cannot figure out what to do to save my live. Can someone please help? Thanks Tony ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350681 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: createodbcdatetime change in cf9?
What is the actual content of the form.payment_date coming from PayPal? It should be something like '08:38:49 Apr 11, 2012 PDT'. The code below works just fine on that value on CF9 in my testing environment. Without the ' PDT' part, the code tries to run createodbcdatetime() on '08:38:49 Apr 11, ', which fails. Im sending this in my test and it fails: 08:38:49 April 11, 2012 EST. If i take out the time and have this Apr 11, 2012 EST It works. I noticed that the date im trying to create an odbc datetiime on is 08:38:49 Apr 11, 2012 and its failing.. That still has the time in it but not the EST. So are you saying i should take off the cut in my code and leave the EST on? Thanks ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350682 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: createodbcdatetime change in cf9?
What I was saying is, I tested the actual code you originally posted on CF9 with 08:38:49 Apr 11, 2012 PDT as the input and it works fine. I was trying to verify that the data you're working with has the timezone on the end, since the cut portion of the code is designed to remove that, and will remove needed data if your input doesn't include it. I just tested again with 08:38:49 April 11, 2012 EST, and your original code also works. Removing the cut won't fix your trouble, because 08:38:49 April 11, 2012 EST isn't a valid date/time string for CF. I used this for my testing: form method=post input type=text name=payment_date value=08:38:49 Apr 11, 2012 EST / buttonPost/button /form cfif isdefined(form.payment_date) cfset payment_date=urldecode(form.payment_date) cfset dl = len(payment_date) cfset cut = dl - 3 cfset paymentdate_temp=removechars(payment_date,cut,4) cfset paymentdate = #createodbcdatetime(paymentdate_temp)# cfdump var=#paymentdate# /cfif I noticed that the date im trying to create an odbc datetiime on is 08:38:49 Apr 11, 2012 and its failing.. That still has the time in it but not the EST. This should work fine: cfdump var=#createodbcdatetime('08:38:49 Apr 11, 2012')# You may be running into an ambiguity issue with CF being type-less. Createodbcdatetime() wants a DateTime object but will accept a string CF thinks it can parse. For my test environment, CF can parse the string you have, but it seems your server environment can't. I can't say for sure why, and getting into the server settings isn't really something I have a lot of experience with. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350683 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: createodbcdatetime change in cf9?
Thank you for your help. I just added this code into a simple cf page: cfset paymentdate = #createodbcdatetime('08:38:49 April 11, 2012 EST')# and i get an error just loading the page: Parameter validation error for the CREATEODBCDATETIME function. The value of parameter 1, which is currently 08:38:49 April 11, 2012 EST, must be a class java.util.Date value. Must be on the server end because it works accross my testing server also. The server is a hosting server in the UK so i dont know if they have something setup differently. Ill have to contact them. Thanks for your help. Tony ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350684 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: createodbcdatetime change in cf9?
That needs to be: cfset paymentdate = #createodbcdatetime('08:38:49 April 11, 2012')# The time zone on the end is invalid in CF. On Wed, Apr 11, 2012 at 2:46 PM, Tony Paolillo tpaoli...@gmail.com wrote: cfset paymentdate = #createodbcdatetime('08:38:49 April 11, 2012 EST')# ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350685 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
cannot insert record with #createodbcdatetime(now())#
I get this error: Error Executing Database Query. [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC SQL Server Driver]Invalid precision value With this query: cfquery name=qry datasource=#this.DSN# result=qryResult INSERT INTO contest ( name,email,phone,age,score,addeddate ) VALUES ( cfqueryparam cfsqltype=CF_SQL_VARCHAR value=#ARGUMENTS.userName# /, cfqueryparam cfsqltype=CF_SQL_VARCHAR value=#ARGUMENTS.userEmail# /, cfqueryparam cfsqltype=CF_SQL_VARCHAR value=#ARGUMENTS.phone# /, cfqueryparam cfsqltype=CF_SQL_INTEGER value=#ARGUMENTS.age# /, cfqueryparam cfsqltype=CF_SQL_INTEGER value=#ARGUMENTS.score# /, cfqueryparam value=#createodbcdatetime(now())# cfsqltype=CF_SQL_TIMESTAMP ) /cfquery If I remove the addeddate column it works. I have done this before without issue. It is an odbc socket connection. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327147 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: cannot insert record with #createodbcdatetime(now())#
Try the SQL Server function GETDATE() instead of a queryparam On Tue, Oct 13, 2009 at 3:01 PM, Matthew Smith chedders...@gmail.comwrote: I get this error: Error Executing Database Query. [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC SQL Server Driver]Invalid precision value With this query: cfquery name=qry datasource=#this.DSN# result=qryResult INSERT INTO contest ( name,email,phone,age,score,addeddate ) VALUES ( cfqueryparam cfsqltype=CF_SQL_VARCHAR value=#ARGUMENTS.userName# /, cfqueryparam cfsqltype=CF_SQL_VARCHAR value=#ARGUMENTS.userEmail# /, cfqueryparam cfsqltype=CF_SQL_VARCHAR value=#ARGUMENTS.phone# /, cfqueryparam cfsqltype=CF_SQL_INTEGER value=#ARGUMENTS.age# /, cfqueryparam cfsqltype=CF_SQL_INTEGER value=#ARGUMENTS.score# /, cfqueryparam value=#createodbcdatetime(now())# cfsqltype=CF_SQL_TIMESTAMP ) /cfquery If I remove the addeddate column it works. I have done this before without issue. It is an odbc socket connection. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327148 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
re: cannot insert record with #createodbcdatetime(now())#
you don't need to use createODBCDateTime() with CFQUERYPARAM. just cfqueryparam value=#now()# cfsqltype=CF_SQL_TIMESTAMP that should do it ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327149 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: cannot insert record with ##createodbcdatetime(now())##
Try the SQL Server function GETDATE() instead of a queryparam On Tue, Oct 13, 2009 at 3:01 PM, Matthew Smith chedders...@gmail.comwrote: Now() didn't work, but getdate() did. Thank you. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327150 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: cannot insert record with ##createodbcdatetime(now())##
Now() didn't work, but getdate() did. Thank you. Weird. While I would not expect an issue, maybe it was related the cf_sql_timestamp? I do not use odbc socket connections. So I am not sure how that type is handled.. -Leigh ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327155 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: cannot insert record with ##createodbcdatetime(now())##
I'll bet he used Now() outside of cfqueryparam, which of course would not work because Now() is a cf function, and getDate() is a transact-sql function. But *THIS* would work: cfqueryparam value=#now()# cfsqltype=cf_sql_timestamp Rick On Tue, Oct 13, 2009 at 5:39 PM, Leigh cfsearch...@yahoo.com wrote: Now() didn't work, but getdate() did. Thank you. Weird. While I would not expect an issue, maybe it was related the cf_sql_timestamp? I do not use odbc socket connections. So I am not sure how that type is handled.. -Leigh ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327157 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: cannot insert record with ##createodbcdatetime(now())##
But *THIS* would work: cfqueryparam value=#now()# cfsqltype=cf_sql_timestamp That sounds more likely. I would have expected both what you posted and his original code to work. ie: cfqueryparam value=#createodbcdatetime(now())# cfsqltype=CF_SQL_TIMESTAMP Granted the createodbcdatetime() is a bit redunant. But it should still work. I thought it might be an odbc socket peculiarity. -Leigh ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327162 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: cannot insert record with ##createodbcdatetime(now())##
Also would've expected it to work too Of course, the real question is why is he using the UDBC Socket to the SQL Server ODBC driver, instead of just using the native SQL Server JDBC Driver? [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC SQL Server Driver]Invalid precision value Rick ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327163 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: cannot insert record with ##createodbcdatetime(now())##
I didn't see the original code, but if the title is accurate, that is why it is not working. ##createodbcdatetime(now())## The double hash on each side will result in the literal string #createodbcdatetime(now())# being passed to the database. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327164 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: cannot insert record with ##createodbcdatetime(now())##
The original thread is here, and that was not the case: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:60230 On Tue, Oct 13, 2009 at 7:06 PM, Matt Quackenbush quackfu...@gmail.com wrote: I didn't see the original code, but if the title is accurate, that is why it is not working. ##createodbcdatetime(now())## The double hash on each side will result in the literal string #createodbcdatetime(now())# being passed to the database. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327166 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: cannot insert record with ##createodbcdatetime(now())##
Heh. Damn. I thought I had spotted something important. ;-) On Tue, Oct 13, 2009 at 6:12 PM, Rick Root wrote: The original thread is here, and that was not the case: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:60230 ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327167 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
CreateODBCDateTime
Hello Guys, I've never been in the habit of using CreateODBCDateTime() in the past but after reading a few times that it's the recommended route to go when entering values into the database I thought I'd give it a shot, however its causing a few issues and so thought I'd come and clear up how this is best applied. I'm running SQL Server 2k5 and on my create and update methods I write the current date and time to a couple of columns, using the following method: DateCreated = cfqueryparam value=#now()# cfsqltype=cf_sql_timestamp / This has always worked nicely and I've never really had any reason to believe that it wouldn't, however, like I say, after reading about the createODBCDateTime() method I thought I'd give that a shot if it's considered to be a better practice. DateCreated = cfqueryparam value=#createODBCDateTime(now())# cfsqltype=cf_sql_timestamp / However this only enters the date into the database, and the time portion is left to sit as 00:00:00. Can anyone explain why this is? And perhaps elaborate a little on when and where I should be using the createODBCDateTime() method and where I should not? Thanks for your time guys, this seems like a bit of a silly question to ask but thought I'd get your thoughts on it. Rob ~| Create robust enterprise, web RIAs. Upgrade to ColdFusion 8 and integrate with Adobe Flex http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:291184 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: CreateODBCDateTime
Out of curiosity if the date/time you want to put in is the system date/time then why even pass it in via CF over using the databases built in functions for date/time? On 10/16/07, Robert Rawlins - Think Blue [EMAIL PROTECTED] wrote: Hello Guys, I've never been in the habit of using CreateODBCDateTime() in the past but after reading a few times that it's the recommended route to go when entering values into the database I thought I'd give it a shot, however its causing a few issues and so thought I'd come and clear up how this is best applied. I'm running SQL Server 2k5 and on my create and update methods I write the current date and time to a couple of columns, using the following method: DateCreated = cfqueryparam value=#now()# cfsqltype=cf_sql_timestamp / This has always worked nicely and I've never really had any reason to believe that it wouldn't, however, like I say, after reading about the createODBCDateTime() method I thought I'd give that a shot if it's considered to be a better practice. DateCreated = cfqueryparam value=#createODBCDateTime(now())# cfsqltype=cf_sql_timestamp / However this only enters the date into the database, and the time portion is left to sit as 00:00:00. Can anyone explain why this is? And perhaps elaborate a little on when and where I should be using the createODBCDateTime() method and where I should not? Thanks for your time guys, this seems like a bit of a silly question to ask but thought I'd get your thoughts on it. Rob ~| Download the latest ColdFusion 8 utilities including Report Builder, plug-ins for Eclipse and Dreamweaver updates. http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:291185 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: CreateODBCDateTime
On 10/16/07, Robert Rawlins - Think Blue [EMAIL PROTECTED] DateCreated = cfqueryparam value=#now()# cfsqltype=cf_sql_timestamp / This has always worked nicely and I've never really had any reason to believe that it wouldn't, however, like I say, after reading about the createODBCDateTime() method I thought I'd give that a shot if it's considered to be a better practice. It's not. There is NO reason to use createODBCDateTime when you're using cfqueryparam. None that I'm aware of. The function exists so that you can do this: DateCreated = #createODBCDateTime(Now())# Without having to worry about the date format that the database wants. However, when using cfqueryparam, that's all taken care of through bind variables. DateCreated = cfqueryparam value=#createODBCDateTime(now())# cfsqltype=cf_sql_timestamp / However this only enters the date into the database, and the time portion is left to sit as 00:00:00. Can anyone explain why this is? It's possible that when passing the value generated by createODBCDateTime() into the query as a bind variable, that the database simply doesn't understand the time portion of the value. Solution: don't do it that way :) -- Rick Root Check out CFMBB, BlogCFM, ImageCFC, ImapCFC, CFFM, and more at www.opensourcecf.com ~| Create robust enterprise, web RIAs. Upgrade to ColdFusion 8 and integrate with Adobe Flex http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:291187 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: CreateODBCDateTime
That's a good question Aaron, I hadn't thought to use the build in functions from SQL to do that for me, I like the idea. Rob -Original Message- From: Aaron Rouse [mailto:[EMAIL PROTECTED] Sent: 16 October 2007 12:55 To: CF-Talk Subject: Re: CreateODBCDateTime Out of curiosity if the date/time you want to put in is the system date/time then why even pass it in via CF over using the databases built in functions for date/time? On 10/16/07, Robert Rawlins - Think Blue [EMAIL PROTECTED] wrote: Hello Guys, I've never been in the habit of using CreateODBCDateTime() in the past but after reading a few times that it's the recommended route to go when entering values into the database I thought I'd give it a shot, however its causing a few issues and so thought I'd come and clear up how this is best applied. I'm running SQL Server 2k5 and on my create and update methods I write the current date and time to a couple of columns, using the following method: DateCreated = cfqueryparam value=#now()# cfsqltype=cf_sql_timestamp / This has always worked nicely and I've never really had any reason to believe that it wouldn't, however, like I say, after reading about the createODBCDateTime() method I thought I'd give that a shot if it's considered to be a better practice. DateCreated = cfqueryparam value=#createODBCDateTime(now())# cfsqltype=cf_sql_timestamp / However this only enters the date into the database, and the time portion is left to sit as 00:00:00. Can anyone explain why this is? And perhaps elaborate a little on when and where I should be using the createODBCDateTime() method and where I should not? Thanks for your time guys, this seems like a bit of a silly question to ask but thought I'd get your thoughts on it. Rob ~| Download the latest ColdFusion 8 utilities including Report Builder, plug-ins for Eclipse and Dreamweaver updates. http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:291188 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
createodbcdatetime change in behaviour?
Has anyone else found a change in behaviour between createodbcdatetime() on ColdFusion 6.1 and ColdFusion 7.1 that affects folks not using USA locale. I'm return a list of files in a directory with cfdirectory - pretty standard and i want to compare the age of the files to the current date, If i then flip the date with createodbcdatetime() is appears on cf7.1 that it's ignoring the locale. On 6.1 I see the following (first column is raw, second is createodbcdatetime() resultant) 06 April 2005 08:16:51 o'clock BST {ts '2005-04-06 08:16:51'} 29 March 2005 11:12:38 o'clock BST {ts '2005-03-29 11:12:38'} 15 June 2005 11:14:20 o'clock BST {ts '2005-06-15 11:14:20'} 10 November 2005 08:22:58 o'clock GMT {ts '2005-11-10 08:22:58'} On 7.1 I see the following; 06/04/05 08:16 {ts '2005-06-04 08:16:00'} 29/03/05 11:12 {ts '2029-03-05 11:12:00'} 15/06/05 11:14 {ts '2015-06-05 11:14:00'} 10/11/05 08:22 {ts '2005-10-11 08:22:00'} So my file 29 March 2005 has gone through a time machine and ended up in 2029!! It would seem that CF7.1 is ignoring the server locale and using USA format for dates. Both instances are running on the same computer - both report English (UK) if you do a getlocale() Any ideas? thanks, john ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:224294 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: createodbcdatetime change in behaviour?
createodbcdatetime() Are you calling createodbcdatetime() directly on strings like 06 April 2005 08:16:51 o'clock BST? If yes, this is wront, createodbcdatetime() expects a date as paremeter, not a string; If you supply a string representing a date, CF will try to convert it first to a date, and guess the format. Many time it will guess wrong. -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:224321 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: createodbcdatetime change in behaviour?
the example i gave is exactly what cfdirectory returns on cf 6.1 - ie a datetime object formatted as 06 April 2005 etc and it does work as i would expect. cf7.1 cfdirectory returns datelastmodified differently to how 6.1 does therefore breaking createodbcdatetime() john. createodbcdatetime() Are you calling createodbcdatetime() directly on strings like 06 April 2005 08:16:51 o'clock BST? If yes, this is wront, createodbcdatetime() expects a date as paremeter, not a string; If you supply a string representing a date, CF will try to convert it first to a date, and guess the format. Many time it will guess wrong. -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:224385 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: createodbcdatetime change in behaviour?
the example i gave is exactly what cfdirectory returns on cf 6.1 - ie a datetime object formatted as 06 April 2005 Exact, but a datetime object formatted is not a datetime object anymore: it is a string. Look at the docs for createodbcdatetime(), it takes a datetime object, not a string. If you supply a string, as I said, CF will try to guess how it could convert it, not always with success, deoending on the format of the string. etc and it does work as i would expect ... because you were lucky ;-) .. cf7.1 cfdirectory returns datelastmodified differently to how 6.1 does therefore breaking createodbcdatetime() Not exactly: breaking your luck ;-/ -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:224435 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Problem with CreateODBCDateTime(Now())
I'm trying to set the date when a user logs in, but it keeps showing up in the database as: cfoutput{ts '2004-09-20 13:21:00'}/cfoutput on my action page I have cfset datetime=cfoutput#CreateODBCDateTime(Now())#/cfoutput cfquery datasource=dsn UPDATE trackusers SET Logindate='#datetime#', IP='#remote_addr#', browser='#http_user_agent#', remote_host='#remote_host#', remote_referer='#http_referer#' WHERE username = '#username#' AND pwd = '#pwd#' /cfquery What am I doing wrong? Thanks Steve [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: Problem with CreateODBCDateTime(Now())
You probably want dateformat(now(), mm/dd/) createodbcdatetime creates, well, an odbc date/time... which is exactly what you're seeing in the database.Usually used during db inserts casue it's the format that most discerning databases like best. Of course, you could always insert the odbcdatetime() value and dateformat() it on display.Choose your poison. -patti I'm trying to set the date when a user logs in, but it keeps showing up in the database as: cfoutput{ts '2004-09-20 13:21:00'}/cfoutput on my action page I have cfset datetime=cfoutput#CreateODBCDateTime(Now())#/cfoutput cfquery datasource=dsn UPDATE trackusers SET Logindate='#datetime#', IP='#remote_addr#', browser='#http_user_agent#', remote_host='#remote_host#', remote_referer='#http_referer#' WHERE username = '#username#' AND pwd = '#pwd#' /cfquery What am I doing wrong? Thanks Steve [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: Problem with CreateODBCDateTime(Now())
few things 1) correct syntax:cfset datetime = createODBCDateTime(now()) 2) datetime might not be the best variable name.i'd suggest login_datetime (or something similar) 3) in your cfquery, assuming 'datetime' is in fact a date/time datatype, it gets no single quotes around it 4) you're not using cfqueryparam try: cfquery datasource=dsn UPDATE trackusers SET Logindate = cfqueryparam value=#createODBCDate(now())# cfsqltype=cf_sql_timestamp, IP = cfqueryparam value=#cgi.remote_addr# cfsqltype=cf_sql_char, browser = cfqueryparam value=#cgi.http_user_agent# cfsqltype=cf_sql_char, remote_host = cfqueryparam value=#remote_host# cfsqltype=cf_sql_char, remote_referer = cfqueryparam value=#cgi.http_referer# cfsqltype=cf_sql_char WHERE username = cfqueryparam value=#form.username#' cfsqltype=cf_sql_char AND pwd = cfqueryparam value=#form.pwd# cfsqltype=cf_sql_char /cfquery On Mon, 20 Sep 2004 14:42:12 -0400, Steve Kahn [EMAIL PROTECTED] wrote: I'm trying to set the date when a user logs in, but it keeps showing up in the database as: cfoutput{ts '2004-09-20 13:21:00'}/cfoutput on my action page I have cfset datetime=cfoutput#CreateODBCDateTime(Now())#/cfoutput cfquery datasource=dsn UPDATE trackusers SET Logindate='#datetime#', IP='#remote_addr#', browser='#http_user_agent#', remote_host='#remote_host#', remote_referer='#http_referer#' WHERE username = '#username#' AND pwd = '#pwd#' /cfquery What am I doing wrong? Thanks Steve [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: Problem with CreateODBCDateTime(Now())
One you don't need the CFOUTPUT's because you are in a CF tag. cfset datetime=#CreateODBCDateTime(Now())# Also, this is making a TimeStamp which some DB's will recognize, some take a normal DateTime format.I'm not sure which DB you are using, but you could also try: CFSET dtvalue=#DateFormat(now(), -mm-dd)# #TimeFormat(now(), HH:mm:ss)# I used dtvalue because datetime could possible be a reserved word somewhere. -Original Message- From: Steve Kahn [mailto:[EMAIL PROTECTED] Sent: Monday, September 20, 2004 1:42 PM To: CF-Talk Subject: Problem with CreateODBCDateTime(Now()) I'm trying to set the date when a user logs in, but it keeps showing up in the database as: cfoutput{ts '2004-09-20 13:21:00'}/cfoutput on my action page I have cfset datetime=cfoutput#CreateODBCDateTime(Now())#/cfoutput cfquery datasource=dsn UPDATE trackusers SET Logindate='#datetime#', IP='#remote_addr#', browser='#http_user_agent#', remote_host='#remote_host#', remote_referer='#http_referer#' WHERE username = '#username#' AND pwd = '#pwd#' /cfquery What am I doing wrong? Thanks Steve [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: Problem with CreateODBCDateTime(Now())
Exactly what she said, my response was just a bit slower. -Original Message- From: Patricia Lee [mailto:[EMAIL PROTECTED] Sent: Monday, September 20, 2004 1:53 PM To: CF-Talk Subject: Re: Problem with CreateODBCDateTime(Now()) You probably want dateformat(now(), mm/dd/) createodbcdatetime creates, well, an odbc date/time... which is exactly what you're seeing in the database.Usually used during db inserts casue it's the format that most discerning databases like best. Of course, you could always insert the odbcdatetime() value and dateformat() it on display.Choose your poison. -patti I'm trying to set the date when a user logs in, but it keeps showing up in the database as: cfoutput{ts '2004-09-20 13:21:00'}/cfoutput on my action page I have cfset datetime=cfoutput#CreateODBCDateTime(Now())#/cfoutput cfquery datasource=dsn UPDATE trackusers SET Logindate='#datetime#', IP='#remote_addr#', browser='#http_user_agent#', remote_host='#remote_host#', remote_referer='#http_referer#' WHERE username = '#username#' AND pwd = '#pwd#' /cfquery What am I doing wrong? Thanks Steve [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: Problem with CreateODBCDateTime(Now())
cfset datetime=cfoutput#CreateODBCDateTime(Now())#/cfoutput Your problem is that you're not saving a date in your database, but the string cfoutput{ts '2004-09-20 13:21:00'}/cfoutput If you have SET Logindate='#datetime#', in your SQL and it does not causes an error, it means your date field is not a date field, but a TEXT field. cfset datetime=CreateODBCDateTime(Now()) cfquery datasource=dsn UPDATE trackusers SET Logindate=#datetime#, ... (no quotes here) /cfquery ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: Problem with CreateODBCDateTime(Now())
if possible, a better approach I think is to have the database insert it instead of CF. This way, you know for sure there would be no errors. [EMAIL PROTECTED] 9/20/2004 11:58:29 AM cfset datetime=cfoutput#CreateODBCDateTime(Now())#/cfoutput Your problem is that you're not saving a date in your database, but the string cfoutput{ts '2004-09-20 13:21:00'}/cfoutput If you have SET Logindate='#datetime#', in your SQL and it does not causes an error, it means your date field is not a date field, but a TEXT field. cfset datetime=CreateODBCDateTime(Now()) cfquery datasource=dsn UPDATE trackusers SET Logindate=#datetime#, ... (no quotes here) /cfquery ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: Problem with CreateODBCDateTime(Now())
On Mon, 20 Sep 2004 12:05:02 -0700, Lawrence Ng [EMAIL PROTECTED] wrote: if possible, a better approach I think is to have the database insert it instead of CF. This way, you know for sure there would be no errors. That'd be fine for an INSERT...this is an UPDATE statement tho -- Charlie Griefer Marta was watching the football game with me when she said, You know, most of these sports are based on the idea of one group protecting its territory from invasion by another group. Yeah, I said, trying not to laugh. Girls are funny. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: Problem with CreateODBCDateTime(Now())
you could create a trigger.. still the same approach I would think [EMAIL PROTECTED] 9/20/2004 12:17:26 PM On Mon, 20 Sep 2004 12:05:02 -0700, Lawrence Ng [EMAIL PROTECTED] wrote: if possible, a better approach I think is to have the database insert it instead of CF. This way, you know for sure there would be no errors. That'd be fine for an INSERT...this is an UPDATE statement tho -- Charlie Griefer Marta was watching the football game with me when she said, You know, most of these sports are based on the idea of one group protecting its territory from invasion by another group. Yeah, I said, trying not to laugh. Girls are funny. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: Problem with CreateODBCDateTime(Now())
its a string now and no longer a datetime type you can always just insert the now() function in the query cfquery datasource=dsn UPDATE trackusers SET Logindate='#now()#', IP='#remote_addr#', browser='#http_user_agent#', /cfquery [EMAIL PROTECTED] 9/20/2004 11:42:12 AM I'm trying to set the date when a user logs in, but it keeps showing up in the database as: cfoutput{ts '2004-09-20 13:21:00'}/cfoutput on my action page I have cfset datetime=cfoutput#CreateODBCDateTime(Now())#/cfoutput cfquery datasource=dsn UPDATE trackusers SET Logindate='#datetime#', IP='#remote_addr#', browser='#http_user_agent#', remote_host='#remote_host#', remote_referer='#http_referer#' WHERE username = '#username#' AND pwd = '#pwd#' /cfquery What am I doing wrong? Thanks Steve [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: Problem with CreateODBCDateTime(Now())
I'm trying to set the date when a user logs in, but it keeps showing up in the database as: cfoutput{ts '2004-09-20 13:21:00'}/cfoutput on my action page I have cfset datetime=cfoutput#CreateODBCDateTime(Now())#/cfoutput cfquery datasource=dsn UPDATE trackusers SET Logindate='#datetime#', IP='#remote_addr#', browser='#http_user_agent#', remote_host='#remote_host#', remote_referer='#http_referer#' WHERE username = '#username#' AND pwd = '#pwd#' /cfquery What am I doing wrong? Thanks Steve Use: SET Logindate=#CreateODBCDAte(datetime)# No quotes. CreateODBCDAteTime() and Now() produce identical results and contain the time element [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
CreateODBCDateTime: When do I have to use it?
When do I need to use CreateODBCDateTime() to insert a date to a sql-server-database? What happens with my code when I move to another database which uses instead of an ODBC-Connection an OLE-DB or JDBC-Connection? Do I have to change all my insert-queries? __ Get the mailserver that powers this list at http://www.coolfusion.com FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: CreateODBCDateTime: When do I have to use it?
When do I need to use CreateODBCDateTime() to insert a date to a sql-server-database? What happens with my code when I move to another database which uses instead of an ODBC-Connection an OLE-DB or JDBC-Connection? Do I have to change all my insert-queries? ODBCdateTime doesn't work on OLE-DB connections, not sure on JDBC If you want to be paranoid about it, then instead of using CreateODBCdateTime(), make a UDF to create a layout that the database will understand... DateFormat(myDate,mmm d ) TimeFormat(myDate,HH:mm:ss) Then insert as Insert into myTable (myDate) Values ('#myDate#') With the apostrophies, it works perfectly... Philip Arnold Technical Director Certified ColdFusion Developer ASP Multimedia Limited Switchboard: +44 (0)20 8680 8099 Fax: +44 (0)20 8686 7911 www.aspmedia.co.uk www.aspevents.net An ISO9001 registered company. ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. ** __ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists