I've got this calling method:
public string RunReportSteps(int _reportKey) {
DataTable fStepsTable;
fStepsTable = GetStepsTable("xxx.console.pr_xxx");
return (string)fStepsTable.Rows[1][3];
}
It calls this private method:
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];
}
}
Why am I getting the following error message?
Procedure or function 'pr_xxx' expects parameter '@ReportKey', which was not supplied.