Hi John,

Firstly, what is happening? Are you getting an error?

CFDump is your friend remember - <cfdump var="#Form#" /> for example will
dump the form scope so you can see what is happening. It's a great weapon in
the debugging arsenal, especially if you can't turn on cf debugging. 

There seem to be a few things about your code. Firstly here:

<cfinput type="Text" name="city" id="#city#" size="50"> - you are assigning
the value of city to the id of the cfinput. This means that on the update
page the value of Form.city will be "". 

So do this instead. This applies to most of your inputs:

<cfinput type="Text" name="city" value="#city#" size="50">

Secondly, I wouldn't let the user think they can edit the ArtistID - this is
a autoincrementing primary key I assume. Display it by all means, but I
wouldn't show it as an editable field. Of course you will still need to pass
it to the update_action page so you can identify which record you are
updating - you can do this as a hidden form variable, or as a url variable
for example.

Lastly, I have to admit I have never ever used cfupdate. Just seems like too
blunt an instrument to me. Your code gives me an error anyway:

"There are no columns found for the Artists table name."

Try writing out the query manually - it's good for getting your head round
sql if you don't know it very well apart from anything else. Don't forget to
cfparam your values to prevent anything nasty from getting into your
database:

<cfquery name="updateArtist" datasource="CF8introArtgallery">
        UPDATE  Artists
        SET             FirstName = <cfqueryparam value="#Form.FirstName#"
cfsqltype="cf_sql_varchar">,
                        LastName = <cfqueryparam value="#Form.LastName#"
cfsqltype="cf_sql_varchar">,
                        Address= <cfqueryparam value="#Form.Address#"
cfsqltype="cf_sql_varchar">
        WHERE   ArtistID = <cfqueryparam value="#Form.ArtistID#"
cfsqltype="cf_sql_integer"> 
</cfquery>

(I've not shown all fields updating here for sake of brevity, but you get
the idea.)

One more thing - once you've got all this working, why not convert it to use
a cfc instead, since you've got your head round them now!

HTH

Will


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4500
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to