I have following SP call
public IEnumerable<classfile> GetData(bool isactive)
{
using (SqlConnection cnn = this.OpenConnection())
{
IList<classfile> SampleList = SqlMapper.Query<classfile>(cnn, "SPName").ToList();
cnn.Close();
return SampleList.ToList();
}
}
How can I send parameters along with above dapper SP call
I tried following
public IEnumerable<classfile> GetData(bool isactive)
{
using (SqlConnection cnn = this.OpenConnection())
{
var parameters = new DynamicParameters();
parameters.Add("@isActive", isactive);
IList<classfile> SampleList = SqlMapper.Query<classfile>(cnn, "SPName", parameters).ToList();
cnn.Close();
return SampleList.ToList();
}
}
but its run time getting error as following
Procedure or function 'SPName' expects parameter '@isActive', which was not supplied.