Re: need help with updating date field
>>CF casts datatypes when necessary in an expression. I don't see how this is any different from any other casting in CF. This is what I meant. http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Upgrade to Adobe ColdFusion MX7 The most significant release in over 10 years. Upgrade & see new features. http://www.adobe.com/products/coldfusion?sdid=RVJR Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:279638 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: need help with updating date field
> This only shows that an ODBC dateTime stamp by default, not that Now() returns it. CFOUTPUT doesn't format anything. It outputs values of expressions. > If it was so, then Now() + 1 would cause an error, since one > cannot add a number to a string. > Try #Now()+1# > and you'll get a number, not an ODBC date. This is because > Now() is known as a date object, thus may be formated as a > date, but Now()+1 is just a number, and formated as such by > CFOUTPUT. CF casts datatypes when necessary in an expression. I don't see how this is any different from any other casting in CF. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! This email has been processed by SmoothZap - www.smoothwall.net ~| Macromedia ColdFusion MX7 Upgrade to MX7 & experience time-saving features, more productivity. http://www.adobe.com/products/coldfusion?sdid=RVJW Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:279629 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: need help with updating date field
>>It's often easier to use CFQUERYPARAM, actually - for example, you don't have to worry about single quotes. But if you want only a date, with no time, you still need to use CreateODBCDate () to format the date properly for CFQUERYPARAM, then it is is not that much easier. -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Upgrade to Adobe ColdFusion MX7 The most significant release in over 10 years. Upgrade & see new features. http://www.adobe.com/products/coldfusion?sdid=RVJR Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:279617 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: need help with updating date field
>>You can easily test this: >>#Now()# This only shows that #Now()+1# and you'll get a number, not an ODBC date. This is because Now() is known as a date object, thus may be formated as a date, but Now()+1 is just a number, and formated as such by CFOUTPUT. -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| 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:279616 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: need help with updating date field
> Thanks all for the quick responses, I've changed the field > name from Date to AccessDate, makes more sense too. I used > cfqueryparam on my insert and just trying to get this thing > to work in the raw first ;). As for using jdbc instead of > odbc, I have yet to get cf to register the ds using the SQL > driver it offers. I'm not an admin and have very little to go > on where configuring cf is concerned since there's not anyone > here that has the know how to get it working correctly using > jdbc drivers. It's often easier to use CFQUERYPARAM, actually - for example, you don't have to worry about single quotes. As for the ODBC vs JDBC thing, that shouldn't be very hard to set up, as long as your administrator knows about connecting to SQL Server via TCP/IP. If your SQL Server is set up to only listen on named pipes, you would have to change it to use TCP/IP. If you can look at the ODBC settings on your server, you can get the information you need. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! This email has been processed by SmoothZap - www.smoothwall.net ~| Create Web Applications With ColdFusion MX7 & Flex 2. Build powerful, scalable RIAs. Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:279615 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: need help with updating date field
> Are you sure of that? > Now () is supposed to return a date-time object which is a > foating point value, not an ODBC date. You can easily test this: #Now()# Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! This email has been processed by SmoothZap - www.smoothwall.net ~| Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 & Flex 2 Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:279614 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: need help with updating date field
>>First, the Now function returns an ODBC timestamp Are you sure of that? Now () is supposed to return a date-time object which is a foating point value, not an ODBC date. But it is possible that it will be automatically converted to an ODBCDate by the CFQUERY tag. And if it does so, then it is probably an ODBDDateTime stamp, including time, which is not the same a CreateODBCDate() which include a 0 time. -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 & Flex 2 Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:279613 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: need help with updating date field
Thanks all for the quick responses, I've changed the field name from Date to AccessDate, makes more sense too. I used cfqueryparam on my insert and just trying to get this thing to work in the raw first ;). As for using jdbc instead of odbc, I have yet to get cf to register the ds using the SQL driver it offers. I'm not an admin and have very little to go on where configuring cf is concerned since there's not anyone here that has the know how to get it working correctly using jdbc drivers. Thank you all for the help, update statement working now ;) Bob ~| Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 & Flex 2 Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:279611 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: need help with updating date field
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 (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 : > > 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
Re: need help with updating date field
Why not just call it with [Date] = getdate() ? On 5/30/07, Bobby Hartsfield <[EMAIL PROTECTED]> wrote: > > 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 (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 : > > > > Awaiting your enlightenment ;) > > > > > > Bob > > > > > > > > > > > > ~| Macromedia ColdFusion MX7 Upgrade to MX7 & experience time-saving features, more productivity. http://www.adobe.com/products/coldfusion?sdid=RVJW Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:279601 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
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 (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 : > > Awaiting your enlightenment ;) > > > Bob > > > > ~| Upgrade to Adobe ColdFusion MX7 The most significant release in over 10 years. Upgrade & see new features. http://www.adobe.com/products/coldfusion?sdid=RVJR Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:279598 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
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 (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 : > > 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:279595 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: need help with updating date field
oooh. good catch :) On 5/30/07, Marius Milosav <[EMAIL PROTECTED]> wrote: > You are missing a comma after '#form.Fax#' > > Marius Milosav > ScorpioSoft Corp. > www.scorpiosoft.com > > -Original Message- > From: Imperial, Robert [mailto:[EMAIL PROTECTED] > Sent: May 30, 2007 12:21 PM > To: CF-Talk > Subject: need help with updating date field > > 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 : > > Awaiting your enlightenment ;) > > > Bob > > > > > > ~| Create Web Applications With ColdFusion MX7 & Flex 2. Build powerful, scalable RIAs. Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:279594 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: need help with updating date field
> 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?? First, the Now function returns an ODBC timestamp, so you don't need to use CreateODBCDate. Second, please use CFQUERYPARAM. Third, you should consider using JDBC instead of ODBC. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! This email has been processed by SmoothZap - www.smoothwall.net ~| Upgrade to Adobe ColdFusion MX7 The most significant release in over 10 years. Upgrade & see new features. http://www.adobe.com/products/coldfusion?sdid=RVJR Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:279592 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: need help with updating date field
I think it should be: Date = #createODBCdate(Now())#, HTH Will -Original Message- From: Imperial, Robert [mailto:[EMAIL PROTECTED] Sent: 30 May 2007 17:21 To: CF-Talk Subject: need help with updating date field 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 : Awaiting your enlightenment ;) Bob ~| Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 & Flex 2 Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:279590 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: need help with updating date field
You are missing a comma after Fax = '#form.Fax#' Should read Fax = '#form.Fax#', -Original Message- From: Imperial, Robert [mailto:[EMAIL PROTECTED] Sent: 30 May 2007 17:21 To: CF-Talk Subject: need help with updating date field 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 : Awaiting your enlightenment ;) Bob ~| Create Web Applications With ColdFusion MX7 & Flex 2. Build powerful, scalable RIAs. Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:279593 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: need help with updating date field
You are missing a comma after '#form.Fax#' Marius Milosav ScorpioSoft Corp. www.scorpiosoft.com -Original Message- From: Imperial, Robert [mailto:[EMAIL PROTECTED] Sent: May 30, 2007 12:21 PM To: CF-Talk Subject: need help with updating date field 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 : Awaiting your enlightenment ;) Bob ~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:279588 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: need help with updating date field
>>Date = '#createODBCdate(Now())#' Tow things here: first a date value needs no quotes in SQL, then use this instead: Date = #createODBCdate(Now())# Secondly, "Date" is a reserved word in several db systems, it would be a good idea to use another field name. -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Macromedia ColdFusion MX7 Upgrade to MX7 & experience time-saving features, more productivity. http://www.adobe.com/products/coldfusion?sdid=RVJW Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:279589 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: need help with updating date field
The word "Date" is a reserved word. It is good practice to avoid naming fields with a reserved word. In this case, wrap it in hard brackets such as [date] = '#createODBCDate(now())#' HTH Steve -Original Message- From: Imperial, Robert [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 30, 2007 12:21 PM To: CF-Talk Subject: need help with updating date field 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 : Awaiting your enlightenment ;) Bob ~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:279587 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: need help with updating date field
Remove the single quotes around #createODBCDate(Now())# ..:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -Original Message- From: Imperial, Robert [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 30, 2007 12:21 PM To: CF-Talk Subject: need help with updating date field 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 : Awaiting your enlightenment ;) Bob ~| ColdFusion MX7 by AdobeĀ® Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:279586 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
need help with updating date field
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 : Awaiting your enlightenment ;) Bob ~| ColdFusion MX7 by AdobeĀ® Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:279585 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4