macromedia.coldfusion.database_access
[Top] [All Lists]

Re: Simple Update Kicking my behind

Subject: Re: Simple Update Kicking my behind
From: "Ken Ford - *ACE*" <newsgroups1@xxxxxxxxxxxx>
Date: Wed, 30 Jan 2008 22:42:39 -0600
Newsgroups: macromedia.coldfusion.database_access


Easiest way I found to do dates was to use a <cfqueryparam>

<cfquery name="UpdateMember" datasource="itla_Membership">
UPDATE MemberList
Set Password = '#Trim(FORM.Password)#',
LastName = '#Trim(FORM.LastName)#',
FirstName = '#Trim(FORM.FirstName)#',
RanchName = '#Trim(FORM.RanchName)#',
AltName = '#Trim(FORM.AltName)#',
Listing  = '#Trim(FORM.Listing)#',
Street  = '#Trim(FORM.Street)#',
City  = '#Trim(FORM.City)#',
State  = '#Trim(FORM.State)#',
Country  = '#Trim(FORM.Country)#',
Region  = '#Trim(FORM.Region)#',
Zip  = '#Trim(FORM.Zip)#',
Phone1  = '#Trim(FORM.Phone1)#',
PhoneTitle1  = '#Trim(FORM.PhoneTitle1)#',
Phone2  = '#Trim(FORM.Phone2)#',
PhoneTitle2  = '#Trim(FORM.PhoneTitle2)#',
Phone3  = '#Trim(FORM.Phone3)#',
PhoneTitle3  = '#Trim(FORM.PhoneTitle3)#',
Phone4  = '#Trim(FORM.Phone4)#',
PhoneTitle4  = '#Trim(FORM.PhoneTitle4)#',
EMail  = '#Trim(FORM.EMail)#',
Website  = '#Trim(FORM.Website)#',
Comments  = '#FORM.Comments#',
DateAdded  =
<cfqueryparam cfsqltype=”cf_sql_date” value=”#FORM.DateAdded#”>,
DateUpdated  =
<cfqueryparam cfsqltype=”cf_sql_date” value=”#Now()#”>,
Active  = '#FORM.Active#',
ShowOnSite  = '#FORM.ShowOnSite#',
EmailList  = '#FORM.EmailList#'
WHERE MemberID = #FORM.MemberID#
</cfquery>

If the cfsqltype="cf_sql_date" does not work try cfsqltype="cf_sql_timestamp" instead.

--
Ken Ford
Adobe Community Expert - Dreamweaver
Fordwebs, LLC
http://www.fordwebs.com


"Kirk_D" <webforumsuser@xxxxxxxxxxxxxx> wrote in message news:fnrgn5$niq$1@xxxxxxxxxxxxxxxxxxxxxxxx
Thanks for the replies.

I didn't think about Password being a reserved word. I will change that. That is not causing my errors because the form works when I take out the two date
fields and the three Yes/No fields.

The field for DateAdded and DateUpdated are date fields in the Access table. The DateAdded field is queried when the form is called and kept in the form as a hidden field. Seems like I have done exactly the same thing before with dates
and didn't have any problem with them. I am trying to fill the DateUpdated
field at the time the Update query runs, but all attempts at figuring that out have been unsuccessful. I tried Now(), but that didn't work. That is when I
tried CreateODBCDateTime(now()).

How do I pass the date as a date? I thought that is what the
CreateODBCDateTime thing was for?

Active and the other two fields are Access Yes/No fields set to Yes/No,
however, if you query the table and output the result of the field, it actually shows 1 or 0, so I was sending that back to it when I set the values. I tried
sending Yes and No to it, but that didn't work either.

I always struggle with Access.

Thanks,

Kirk



<Prev in Thread] Current Thread [Next in Thread>