我有这个调用方法:
public string RunReportSteps(int _reportKey) {
DataTable fStepsTable;
fStepsTable = GetStepsTable("xxx.console.pr_xxx");
return (string)fStepsTable.Rows[1][3];
}
它调用这个私有方法:
private DataTable GetStepsTable(string procName) {
var connectionString = ConfigurationManager.ConnectionStrings["xxx"].ConnectionString;
using(var conn = new SqlConnection(connectionString))
using(var adapt = new SqlDataAdapter())
using(var cmd = new SqlCommand(procName, conn)) {
conn.Open();
SqlParameter p = new SqlParameter("@ReportKey", this.ReportKey);
p.Direction = ParameterDirection.Input;
cmd.Parameters.Add(p);
adapt.SelectCommand = cmd;
DataSet mySet = new DataSet();
adapt.Fill(mySet); //<<<<<<<<<<<<<<<<<<<errors here
return mySet.Tables[0];
}
}
为什么我会收到以下错误消息?
过程或函数“pr_xxx”需要未提供的参数“@ReportKey”。