Coldfusion执行sql语句出错

发布于 2025-01-06 08:40:09 字数 557 浏览 0 评论 0原文

我不断收到一条错误消息:

函数 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

抱着落日 2025-01-13 08:40:09

你确定语法正确吗?我不记得结尾了:所以会尝试(记下尾随空格)

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

当然可能只是您的值上的尾括号位于引号的错误一侧

类似的问题在此 在 cfscript 查询中使用查询参数时出错

如果当然这是由于 C+P 错误,请重新发布源代码

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

脱离于你 2025-01-13 08:40:09

这听起来像是 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文