首页新闻找找看学习计划

C# nhibernate 操作存储过程异常

0
悬赏园豆:20 [待解决问题]

string strQuery = "proc_SelectUserInfo '" + strUsername + "','" + strPwd + "','" + ipaddress + "',0";
objUserInfo = objSelectUserInfoRepository.ExecuteProcReturnList(strQuery);

/// </summary>
/// <param name="strProcedure">过程名称,比如:【ExecuteProcReturnList(Proc_SelectUser 10)】</param>
/// <returns>匿名对象组</returns>
public virtual IList<T> ExecuteProcReturnList(string strProcedure)
{
try
{
using (var session = GetSession("write").OpenSession())
{
string strQuery = " execute dbo." + strProcedure;
return CreateSQLQuery(strQuery);
}
}
catch (Exception ex)
{
logger.Error(ex.ToString());
return null;
}
}
public virtual IList<T> CreateSQLQuery(string strQuery)
{
using (var session = GetSession("write").OpenSession())
{
try
{
strQuery = strNocounton + strQuery;
return session.CreateSQLQuery(strQuery).AddEntity(typeof(T).Name, typeof(T)).List<T>();
}
catch (Exception ex)
{
throw new Exception(ex.Message.ToString());
}
}
}

错误提示:

could not execute query
[ set nocount on; execute dbo. proc_SelectUserInfo '0482','2941F1362692D47B','::1','0' ]
[SQL: set nocount on; execute dbo. proc_SelectUserInfo '0482','2941F1362692D47B','::1','0']

 有时候又没有任何错误提示,也得不到任何 数据,是为什么?大咖门,出来了



大咖来指点下哈。

JonesVale的主页 JonesVale | 初学一级 | 园豆:184
提问于:2016-12-08 13:37
< >
分享
所有回答(1)
0

先看看数据库有没有锁表

风行魔狼 | 园豆:487 (菜鸟二级) | 2016-12-09 09:12
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册