Hi John,

This is potentially a massive area, and you could well find yourself well
into OO before you know it. And of course there are many ways to skin a cat.

That said, and steering clear of OO for the moment, let's just say that I
would keep all my business logic in cfcs. So yes, add, edit & delete for
sure, but also anything else that you use cf for can be a in a cfc. 

Let's say you have a form that allows users to sign up to your site. You
probably want to check to see if the username they've chosen is already in
use, or perhaps if the email address is already registered, something like
that.

You'd have a function in your cfc that checks for the existence of a record
with username x, and a function that adds a new user to the db. The
addNewUser function can call the checkUsername function before doing the
insert. 

This is really general, because as mentioned there are so many options. Get
used to using cfcs first, then maybe look into OO principles if you want to
go to that level. I'm not going to get anywhere near the pros and cons
debate for OO here (mainly because most of it goes right over my head!!). 

You might also eventually want to look at using an ORM like Transfer
http://www.transfer-orm.com/ to handle your crud operations (and many other
things), especially as CF9 will have built in ORM support, but I'd get your
head round what you can and can't do with cfcs first.

Take a look at the livedocs for much more about cfcs:

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Part_3_CFM
L_Ref_1.html

Hope this is of some help.

Will
 



-----Original Message-----
From: John Barrett [mailto:[email protected]] 
Sent: 14 April 2009 07:35
To: cf-newbie
Subject: Re: cfform & updating


Hi Will,
Thanks so much for your help, this worked like a charm, and I got to learn a
little more on SQL in the process!
Yes, my plan is to convert the queries to a cfc, but can I ask for a project
where you display, update, delete, or insert a new user what you you convert
to a cfc, just the query, or would there be more?
I am liking cfc`-`

Thanks so much for your help!
John



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:4519
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