Quote:
var p= new DynamicParameter();
modell.QuantityAgain= p.Get<int>("quantity").ToString();
It's hardly surprising that
Get
fails, given that you've literally just created the
DynamicParameters
object, and haven't added any parameters to it!
Compare your code to the example in the documentation:
GitHub - StackExchange/Dapper: Dapper - a simple object mapper for .Net[
^]
public int GetStockQuantity(TransactionsModel model)
{
using (IDbConnection connection= new MySqlConnection(GlobalConfig.CnnString(mydb)))
{
var p = new DynamicParameter();
p.Add("@book_titlesp", model.Transacted_book_name);
p.Add("@quantity", dbType: DbType.Int32, direction: ParameterDirection.Output);
connection.Execute("Book_GetAll_By_BookTitle", p, commandType: CommandType.StoredProcedure);
return p.Get<int>("@quantity");
}
}