简体   繁体   中英

Coldfusion error executing a sql statement

I keep getting a error that says,

Argument 2 of function Replace cannot be an empty

I can't figure out what I'm doing wrong.

The code:

local.drafts.setSQL( "INSERT messages (tm, draft, linkA, linkB) values (:tm:, :draft:, :linkA:, :linkB:");
local.drafts.addParam(name="tm",value=s,CFSQLTYPE="CF_SQL_TIMESTAMP");
local.drafts.addParam(name="draft",value=1, CFSQLTYPE="CF_SQL_BIT");
local.drafts.addParam(name="linkA",value=h,CFSQLTYPE="CF_SQL_SMALLINT");
local.drafts.addParam(name="linkB",value=b,CFSQLTYPE="CF_SQL_SMALLINT");    
local.drafts.execute();

Are you sure the syntax is correct? I don't recall the ending : so would try (keeping note of trailing spaces)

local.drafts.setSQL("INSERT INTO messages (tm, draft, linkA, linkB) VALUES ( :tm , :draft , :linkA , :linkB )");

Might just be that your trailing bracket on the VALUES is on the wrong side of a quote of course

Similar issue was seen in this Error using Query Parameters with cfscript query

If of course this is due to a C+P error please re-post source

This sounds like an issue with Mura's Search Engine Safe (SES) URLs.

This is a replace function error see hasbro's example! http://webcache.googleusercontent.com/search?q=cache:a0Dxwwp5iPsJ:www.hasbro.com/games/en_US/clue/virtual-mansion/fileSizes.cfm%3Ffn0%3D%26fn1%3Dclue.swf%26&hl=en&gl=us&strip=1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM