J
Joneleth
Hi,
I'm developing an ASP.NET web application with MySql 5.
I have a little problem: if i create a stored procedure like this one:
CREATE PROCEDURE `spProva` (out retval int, in idemployee int)
BEGIN
UPDATE employee e SET e.Room = 'Milan 41' WHERE e.IdEmployee =
idemployee;
SET retval = idemployee;
END
everything works fine, while if I use a textual query programmatically
created:
string sqlText = "UPDATE employee e SET e.Room = ?Room
WHERE e.IdEmployee=?IdEmployee; ";
sqlText += "SET ?retval = ?IdEmployee; ";
with ?Room, ?IdEmployee and ?retval presetted parameters, an error
raises: #42000You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to
use near '0 = 55'.
It seems that the expression is pre-evaluated and the variables
replaced before executing the query, and so an instruction like 'SET 0
=
55' clearly has no sense.
Is there any way to work around that issue, without using stored
procedure?
Thanks.
I'm developing an ASP.NET web application with MySql 5.
I have a little problem: if i create a stored procedure like this one:
CREATE PROCEDURE `spProva` (out retval int, in idemployee int)
BEGIN
UPDATE employee e SET e.Room = 'Milan 41' WHERE e.IdEmployee =
idemployee;
SET retval = idemployee;
END
everything works fine, while if I use a textual query programmatically
created:
string sqlText = "UPDATE employee e SET e.Room = ?Room
WHERE e.IdEmployee=?IdEmployee; ";
sqlText += "SET ?retval = ?IdEmployee; ";
with ?Room, ?IdEmployee and ?retval presetted parameters, an error
raises: #42000You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to
use near '0 = 55'.
It seems that the expression is pre-evaluated and the variables
replaced before executing the query, and so an instruction like 'SET 0
=
55' clearly has no sense.
Is there any way to work around that issue, without using stored
procedure?
Thanks.