It's pretty easy.  Create your datasource in the CF administrator and 
verify that the connection works - we'll call it "DSN" for this.  
Essentially, you're setting up all the connection parameters (login 
name, password, network location, etc) then applying an easy-to-remember 
name to that instance, so you don't have to go through the rigamarole of 
passing login information with every query call.  Once that's working, 
you can go into your CFML template, and write something like this:

<cfquery datasource="DSN" name="someQuery">
    SELECT *
    FROM SOUFFLES
    WHERE INGREDIENT = 'SPINACH'
</cfquery>

Since the datasource name maps directly to whatever DB you want, you can 
use whatever SQL syntax you like, as long as it's within whatever the 
scope of what your database's language parser can understand. 

You can "pre-write" queries for your database system in the form of 
stored procedures (if they're supported) and call them with the 
<cfstoredproc> tag, passing and recieving variables to it with the 
<cfprocparam> tag.

- Jim

Sean Nelson wrote:

>Sorry for what is probably the easiest question for you folks but hey I'm new to 
>this.  Short and sweet.  Do I have to create the query in the database itself and 
>then use the name in the <cfquery name="whatever" datasource="database.mdb">or does 
>CF just tell the DB what the query is in its own language?
>
>
>---------------------------------
>Do you Yahoo!?
>SBC Yahoo! DSL - Now only $29.95 per month!
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to