You can always use the database to get the date too.  In SQL its just
getDate(). Other databases may / will have different functions to get
the current date. 

[Date] = getDate()

Chris 

-----Original Message-----
From: Bobby Hartsfield [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 30, 2007 12:48 PM
To: CF-Talk
Subject: RE: need help with updating date field

Wow... that was just one messed up query I guess heh. I stopped with the
first error I saw... so to recap class...

            UPDATE AdminPersonnel
            SET First_Name = '#form.First_Name#',
                        Last_Name = '#form.Last_Name#',
                        MI = '#form.MI#',
                        Division = '#form.division#',
                        Degree = '#form.Degree#',
                        Title = '#form.Title#',
                        Email = '#form.Email#',
                        Phone = '#form.Phone#',
                        Fax = '#form.Fax#',
                        [Date] = #createODBCdate(Now())#,
                        IPAddress = '#CGI.REMOTE_ADDR#'
            WHERE ID =     #val(form.ID)#

---------------------------------------------------
DON'T FORGET TO CHANGE ALL THOSE TO CFQUERYPARAMS!
---------------------------------------------------

...:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com


-----Original Message-----
From: Charlie Griefer [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 30, 2007 12:28 PM
To: CF-Talk
Subject: Re: need help with updating date field

first off, DATE is a reserved word and probably shouldn't be used as a
column name.  if you can't change it, at least enclose it in brackets
([DATE])

in your SQL, remove the single quotes from the #createODBCDate(now())#
value.

also, look into using <cfqueryparam> (hey if i didn't say it, somebody
else would have) :)

On 5/30/07, Imperial, Robert <[EMAIL PROTECTED]> wrote:
> I know this is probably obvious to most of you here, but I have an
error
> on an update statement that I need some enlightenment on please. I'm
> using MSSQL2k, CFMX7 and I have an insert statement that works fine
> using "#createODBCdate(Now())#" but my update bombs on it?? Here's my
> update:
>
>             UPDATE AdminPersonnel
>             SET First_Name = '#form.First_Name#',
>                         Last_Name = '#form.Last_Name#',
>                         MI = '#form.MI#',
>                         Division = '#form.division#',
>                         Degree = '#form.Degree#',
>                         Title = '#form.Title#',
>                         Email = '#form.Email#',
>                         Phone = '#form.Phone#',
>                         Fax = '#form.Fax#'
>                         Date = '#createODBCdate(Now())#',
>                         IPAddress = '#CGI.REMOTE_ADDR#'
>             WHERE ID =     #form.ID#
>
> And here is the error
>
> Error Executing Database Query.
>
> [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC SQL
> Server Driver][SQL Server]Line 1: Incorrect syntax near 'Date'.   The
> error occurred in D:\WebNew\domis\admin\actUpdateAdminPersonnel.cfm:
> line 16: line 1
> Called from D:\WebNew\index.cfm: line 17
> 14 :           Date = '#createODBCdate(Now())#',
> 15 :           IPAddress = '#CGI.REMOTE_ADDR#'
> 16 :    WHERE ID =     #form.ID#
> 17 : </cfquery>
>
> Awaiting your enlightenment ;)
>
>
> Bob
>
>
>
> 





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ 

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

Reply via email to