SessionFactory 下 的 CreateQuery(),如何拼接 多个参数
有个语法的问题:没查到合适的资料,请教下大家 ,多谢了
1.sql 语句是:update
dbo.T_Article
set TypeID=28
where TypeID=19
and id
in(306,308)
2. 需求:拼接到.CreateQuery()
3.问题:多个参数怎么拼接 in(306,308)
---------------------------------------------
/// <summary>
///
/// </summary>
/// <param name="OldParAid">当前选中的父节点 </param>
/// <param name="OldChiAidint">当前选中的字节点</param>
/// <param name="NewParAid">批量移动后的父节点</param>
/// <returns></returns>
public IList<Article> RemoveByArticleID(int OldParAid,int OldChiAidint , params int[] NewParAid)
{
string strOldParAid = "a.ArticleType=:oldParAid";
string strNewParAid ="a.ArticleType=:oldNewAid";
string strOldChiAidint = "a.Id=:newParAid"; //id name="Id" column="id"
IQuery QueryRemove = SessionFactory.GetCurrentSession().CreateQuery("update Article a set " + strNewParAid + " where " + strOldParAid + "and id in (306,308) ");//移除节点
}