Vikas Rana Vikas Rana - 24 days ago 7x
MySQL Question

Syntax error in mysql stored procedure calling from EF 6

I am calling a stored procedure from MVC 5 application with Entity Framework 6. It is throwing this error:

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 'rv_test_param 1' at line 1

My code is:

var res = Context.Database.SqlQuery<string>("rv_test_param @id", new MySqlParameter("@id", 1)).ToList();

The stored procedure is working fine. If I call stop without parameters

Like this:

var redf = Context.Database.SqlQuery<string>("rv_test").ToList();

it also works fine. Does Anyone have an idea why it is not working with parameters?


Syntax mistake. I'm from a SQL Server background, so I was not aware of these syntaxes. This is working for me:

var res = Context.Database.SqlQuery<string>("call rv_test_param(@id)", new MySqlParameter("@id", 1)).ToList();