Hi all --

I have an edit record form that populates the fields with values from a 
database. The user can make changes to the information, click the Submit 
button, 
and the database is updated.

Here's the code for the Update query:

<cfquery name="query1" datasource="#dsn#">
UPDATE Accounts
Set Name='#form.Name#', PlanYearStartDate='#form.PlanYearStartDate#', 
ContactFName='#form.ContactFName#', ContactLName='#form.ContactLName#', 
ContacteMail='#form.ContacteMail#', ContactPhone='#form.ContactPhone#', 
eMailDayOfMonth=#form.eMailDayOfMonth#, eMailFrequency=#form.eMailFrequency#
WHERE GroupNo='#form.GroupNo#';
</cfquery>

It works fine as long as there is data in every form field. If a form field is 
blank, however, CF throws up. For example, if I deleted the ContactPhone, 
eMailDayofMonth, and eMailFrequency data in the form fields, I get an error 
message with the following SQL:

UPDATE  Accounts Set Name='GroupName', PlanYearStartDate='01-Jan-11',  
ContactFName='FName', ContactLName='LName',  ContacteMail='em...@email.com', 
ContactPhone='', eMailDayOfMonth=,  eMailFrequency= WHERE GroupNo='A5432';

How should I handle this?

Scott

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:343435
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to