ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 12th, 2003, 01:25 PM
jag5311 jag5311 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 69 jag5311 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 37 sec
Reputation Power: 5
Using Access 2000 w/coldfusion. Need help setting DATE

Ok, I don't want to write a huge write up here because I am at my wits end. I have been having problems UPDATING a form because of a column in one of my tables called "articledate"

I have/had that column in Access set to Date/Time and the format I typed as yyyy-mm-dd

Now, in coldfusion, I made sure to manipulate the date value to be

#DateFormat(articledate, "yyyy-mm-dd")#

Well, I have had nothing but grief because it never even shows the appropriate date.

I enter 1995-12-05 and it returns something stupid like

1905-05-31

Why its screws it up is beyond me.

So what am I asking is for someone to just tell me the most basic way to get a date in access to work with coldfusion without any problems. At least then, I can tweak it from there.

What values do I set in Access, what do I have to do in Coldfusion to get it to work, etc..

Thanks
Bryan

Reply With Quote
  #2  
Old December 12th, 2003, 01:53 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,648 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 12 h 8 m 20 sec
Reputation Power: 53
If the field is a date data type in Access, you can try using the ODBC date functions like:

#createODBCDate( Now() )# or
#createODBCDate( '12/31/03' )#

See if that works.

Reply With Quote
  #3  
Old December 12th, 2003, 02:09 PM
jag5311 jag5311 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 69 jag5311 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 37 sec
Reputation Power: 5
If you don't mind me asking here are a couple files that contain my code

1. This file contains the coldfusion code for the actual FORM page where information is either entered or edited
http://www.btkdesigns.com/editform.htm

2. This page is where the "magic" happens, where it will INSERT or UPDATE depending on what has been passed
http://www.btkdesigns.com/insert-edit.htm

This might bring some light into the problem

Now, do I need to alter the FORMAt in access, or just leave it blank?

Thanks
Bryan

Reply With Quote
  #4  
Old December 13th, 2003, 12:49 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,648 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 12 h 8 m 20 sec
Reputation Power: 53
I think that all you should need to do is use the odbcDateFormat() function in the insert and update:

<cfset EditMode=IsDefined("FORM.articleID")>
<cfif EditMode>
<CFQUERY datasource="#dsn#">
UPDATE articles
SET gamedID=<cfqueryparam value="#FORM.gameID#" cfsqltype="cf_sql_integer">,
typeID=<cfqueryparam value="#FORM.articletypes#" cfsqltype="cf_sql_integer">,
articletitle=<cfqueryparam value="#Trim(FORM.articletitle)#" cfsqltype="cf_sql_varchar">,
articletext=<cfqueryparam value="#Trim(FORM.articletext)#" cfsqltype="cf_sql_varchar">,
articledescription=<cfqueryparam value="#Trim(FORM.articleID)#" cfsqltype="cf_sql_varchar">,
articledate=<cfqueryparam value="#odbcDateFormat( trim( FORM.articledate ) )#," cfsqltype="cf_sql_date">,
postedby=<cfqueryparam value="#Trim(FORM.postedby)#" cfsqltype="cf_sql_varchar">,
postedemail=<cfqueryparam value="#Trim(FORM.postedemail)#" cfsqltype="cf_sql_varchar">
WHERE articleID=<cfqueryparam value="#FORM.articleID#" cfsqltype="cf_sql_integer">
</CFQUERY>
<cfset formtitle="You have Updated article #FORM.articletitle#">
<CFSET yes="Please go back to the menu list and confirm the deletion, <a href=""gamelist.cfm"" class=""body"">Go back</a>">
<cfelse>
<CFQUERY datasource="#dsn#">
INSERT INTO articles (gameID,
typeID,
articletitle,
articletext,
articledescription,
articledate,
postedby,
postedemail )
VALUES ( #FORM.gameID#,
#FORM.articletypes#,
'#TRIM(FORM.articletitle)#',
'#TRIM(FORM.articletext)#',
'#TRIM(FORM.articledescription)#',
#odbcDateFormat( trim( FORM.articledate ) )#,
'#TRIM(FORM.postedby)#',
'#TRIM(FORM.postedemail)#' )
</cfquery>
<cfset formtitle="You have Inserted article #articletitle#">
<cfset yes="Please go back to the menu list and confirm the deletion, <a href=""gamelist.cfm"" class=""body"">Go back</a>">
</cfif>


See if that works.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Using Access 2000 w/coldfusion. Need help setting DATE


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway