34,838
社区成员




SqlParameter[] parm = new SqlParameter[2]{
new SqlParameter("@table", SqlDbType.VarChar, 20),
new SqlParameter("@partno", SqlDbType.VarChar, 30),
};
parm[0].Value = "st" ;
parm[0].Value = partno.Trim();
Console.WriteLine(partno.Trim());
DataSet ds = SqlHelper.ExecuteDataSet(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sql, parm);
DataTable dt = ds.Tables[0];
return dt;
[/quote]
对看样子,就只能改成存储过程了,其实参数什么的都一样,只不过是不再调用sp_executesql了,而是你自己的写的存储过程,然后里面拼接语句,然后用exec 来执行
SqlParameter[] parm = new SqlParameter[2]{
new SqlParameter("@table", SqlDbType.VarChar, 20),
new SqlParameter("@partno", SqlDbType.VarChar, 30),
};
parm[0].Value = "st" ;
parm[0].Value = partno.Trim();
Console.WriteLine(partno.Trim());
DataSet ds = SqlHelper.ExecuteDataSet(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sql, parm);
DataTable dt = ds.Tables[0];
return dt;