Try This
UPDATE tablename
SET blah = '#form.blah#'
cfif isDefined(attributes.String1)
,string1 = attributes.String1
/cfif
cfif isDefined(attributes.String2)
,string2 = attributes.String2
/cfif
cfif isDefined(attributes.String3)
,string3 = attributes.String3
/cfif
WHERE theid = #form.theid#
with regards to create the set you are going to have to set a flag
with what you want to update i.e. if the update button is clicked or a
hidden form value is equal to something if you explain the scenario I
will be able to advise you better but the above will give you the
ability to create a dynamic update statement without worrying about the
,.
Cheers
Jerry Staple
Web Application Developer
Certified Coldfusion (5.0) Developer
Head Office
133-137 Lisburn Road, Belfast
Northern Ireland BT9 7AG
T +44 (0) 28 9022 3224
F +44 (0) 28 9022 3223
E [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
W biznet-solutions.com http://www.biznet-solutions.com/
From: Chakka, Sudheer [mailto:[EMAIL PROTECTED]]
Sent: 29 March 2002 16:10
To: CF-Talk
Subject: Creating update statements on the fly
HI,
I wanted to create a Update statement on the fly. For creating a
Select
statement on the fly I have used
Select * from tablename
Where 0=0
cfif isDefined(attributes.String1)
and String1 = attributes.String1
/cfif
How can I achieve this for update statement as I couldn't figure out
where to put Set statement and the last line with out coma(',') in my
statement.
Thanks in advance.
Sudheer Chakka.
__
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists