冒号 ':'错误 - 并非所有命名参数都已在 Nhibernate 中设置?
每当我从用户界面传递字符“:”时,我都会遇到问题。 NHibernate 将其误认为是命名参数并抛出错误,因为它没有任何值。
例外是:-
并非所有命名参数都已 设置:[%] [从表中选择 COUNT (*) 个 t WHERE t.FirstName LIKE ':%' AND t.ID IN (38, 20)]"
有什么解决办法吗?
I got a problem whenever I pass char ":" from the user interface. NHibernate mistakes it as a named parameter and throws an error, since there isn't any value for it.
Exception is :-
Not all named parameters have been
set: [%] [SELECT COUNT (*) FROM Table
t WHERE t.FirstName LIKE ':%' AND
t.ID IN (38, 20)]"
Is there any work around?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能以错误的方式创建查询(也许是连接字符串?)
所有这些工作:
You are probably creating the query in a wrong way (concatenating strings, maybe?)
All of these work:
使用 SQL LIKE 时需要转义特殊字符。尝试将参数传递为
@"\" + ":";
。You need to escape special characters when using SQL LIKE. Try passing the parameter as
@"\" + ":";
.