【发布时间】:2010-08-04 08:35:04
【问题描述】:
当我使用 NHibernate 时(顺便说一句,我是它的初学者),我能够在我的输出中获得对 Db 的 SQL 调用。但是在我复制并粘贴到 Management Studio 后,我无法让它们工作。
因为它缺少参数声明。
我得到类似的东西:
SELECT this_.PK_Product as PK1_1_0_, this_.ProductCode as ProductC2_1_0_
, this_.ProductName as ProductN3_1_0_, this_.ProductCodeISO2 as ProductC4_1_0_
, this_.NotUsed as NotUsed1_0_, this_.Confirmed as Confirmed1_0_, this_.LabelRequired as LabelReq7_1_0_ FROM tProduct this_
WHERE (this_.NotUsed = @p0 and this_.Confirmed = @p1 and this_.LabelRequired = @p2);@p0 = False [Type: Boolean (0)], @p1 = True [Type: Boolean (0)], @p2 = False [Type: Boolean (0)]`enter code here`
当我在 SQL Management Studio 中执行此操作时,出现错误:
消息 137,第 15 级,状态 2,第 1 行 必须声明标量变量“@p0”。
我可以告诉 NHibernate 在创建的查询字符串中添加参数声明吗?
谢谢
【问题讨论】:
标签: c# .net sql nhibernate