Coldfusion执行sql语句出错
我不断收到一条错误消息:
函数 Replace 的参数 2 不能为空
我不知道我做错了什么。
代码:
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();
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();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你确定语法正确吗?我不记得结尾了:所以会尝试(记下尾随空格)
当然可能只是您的值上的尾括号位于引号的错误一侧
类似的问题在此 在 cfscript 查询中使用查询参数时出错
如果当然这是由于 C+P 错误,请重新发布源代码
Are you sure the syntax is correct? I don't recall the ending : so would try (keeping note of trailing spaces)
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
这听起来像是 Mura 的搜索引擎安全 (SES) URL 的问题。
这是替换函数错误,请参阅孩之宝的示例!
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
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