SQL in() 和base.Dispose(disposing)的问题求助。。。

jacksonhf jacksonhf 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
 
public DataSet get_doc(string cuid,int doctype)
{
SqlParameter[] pars ={
MakeInParam("@cuid",SqlDbType.NVarChar,200,cuid),
MakeInParam("@doctype",SqlDbType.TinyInt,4,doctype),
};
return RunProc("select a.*, b.flow_name, c.node_name, c.node_type_id, c.node_order_id, c.node_next_id from t_doc a, t_flow b, t_node c where a.df = 0 and a.cu in (@cuid) and a.st in ( 0,1,4 ) and a.doc_type = @doctype and a.flow_id *= b.flow_id and a.node_id *= c.node_id order by a.doc_id desc", pars, "t_doc123");
}


public DataSet RunProc(string procN, SqlParameter[] prams, string tbN)
{
SqlDataAdapter dap = CreateDataAdaper(procN, prams);
DataSet ds = new DataSet();
dap.Fill(ds, tbN);
this.Close();
return ds;
}


private SqlDataAdapter CreateDataAdaper(string procN, SqlParameter[] prams)
{
this.Open();
SqlDataAdapter dap = new SqlDataAdapter(procN,con);
dap.SelectCommand.CommandType = CommandType.Text;
if (prams != null)
{
foreach (SqlParameter parameter in prams)
dap.SelectCommand.Parameters.Add(parameter);
}
dap.SelectCommand.Parameters.Add(new SqlParameter("ReturnValue", SqlDbType.Int, 4,
ParameterDirection.ReturnValue, false, 0, 0,
string.Empty, DataRowVersion.Default, null));

return dap;
}


问题出在这个语句:
select a.*, b.flow_name, c.node_name, c.node_type_id, c.node_order_id, c.node_next_id from t_doc a, t_flow b, t_node c where a.df = 0 and a.cu in (@cuid) and a.st in ( 0,1,4 ) and a.doc_type = @doctype and a.flow_id *= b.flow_id and a.node_id *= c.node_id order by a.doc_id desc
的in (@cuid)
程序会跳到:

protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

如果不传参数,直接in(1,2,3,4)这样。程序就没问题了。
请问有为什么和怎么解决呢?
...全文

相关推荐

评论 8
收藏 已收藏
分享
返回顶部
jacksonhf
C# 111,129 成员 642,540 内容