我的老板希望我使用cfscript而不是标签进行数据库交互。有人知道任何好的教程吗?我购买了Adobe ColdFusion应用程序开发书,第2卷。但它没有太多的脚本。我没有谷歌,发现this site,但它没有解释太多。ColdFusion:试图在CFScript中查询数据库
是否有任何机构知道访问CFScript中的数据库的任何优秀教程?
基本上我有以下转换为使用CFSCRIPT:
<cfquery name="drafts" datasource="ICEchat">
SELECT * from Messages where IsTemp=1 and LinkA=#FORM.LinkA# and LinkB=#FORM.LinkA#
</cfquery>
<cfif drafts.recordcount GT '0'>
<cfquery name="Attachments" datasource="ICEchat">
SELECT * FROM Attachments where id=2
</cfquery>
{ Message:"<cfoutput query="drafts">#Message#</cfoutput>", Attachments:[<cfoutput query="attachments">
"#url#"<cfif attachments.currentRow LT attachments.recordcount>,</cfif>
</cfoutput>]}
<cfelse>
<cfquery name="addrecord" datasource="ICEchat">
INSERT INTO Messages
VALUES(1,1,' ',1)
</cfquery>
{ Message:"NA", Attachments:[]}
</cfif>
你说得对,杰克,这很糟糕。但是,我花了不到一分钟的时间来修复它。哪个更具有建设性:抱怨或修复它? – 2012-02-11 02:15:03
那么,这里是官方文档。 http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSe9cbe5cf462523a0693d5dae123bcd28f6d-7ffb.html – 2012-02-11 02:23:48
@AdamTuttle当然,你是对的。在忽略这样的事情时会发现更多的美德。 – 2012-02-11 03:32:25