What is a proper way of calling a stored procedure with 2 parameters and getting result back which contain 10 columns and 403 records.
Below is the code I have written.
try
{
string startDate = procedureResource.StartDate.ToString("yyyy-MM-dd") + " 00:00:00";
string endDate = procedureResource.EndDate.ToString("yyyy-MM-dd") + " 23:59:59";
var FromDate = new MySqlParameter("@FromDate", startDate);
var ToDate = new MySqlParameter("@ToDate", endDate);
var financial = context.Query<FinancialResource>().FromSql("EXECUTE GetChargesFromToDate @FromDate,@ToDate", FromDate, ToDate).ToList();
return financial;
}
catch(Exception ex) { Console.Write(ex);throw ex; }
and here is the exception
{"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2019-09-28 00:00:00','2019-10-04 23:59:59'' at line 1"}
FromSql("CALL GetChargesFromToDate(@p0, @p1)", startDate, endDate)instead.