C
Join ServerC#
help
❔ Dapper - Call stored procedure error
Uuselessxp1/31/2023
I finished to write my first POST Api, but I get an error when I execute it and it call a stored procedure.
I checked all parameters, count and names, and they are ok, what am I forgetting?
-$exception {"OUT or INOUT argument 1 for routine mydb.storedprocedure is not a variable or NEW pseudo-variable in BEFORE trigger"} MySqlConnector.MySqlException
ErrorCode StoredProcedureNotVariableArgument MySqlConnector.MySqlErrorCode
I checked all parameters, count and names, and they are ok, what am I forgetting?
Uuselessxp1/31/2023
update: I gained the access to the DB and I noticed that the procedure I'm calling have the first parameter as INOUT, then I setted my parameter to INOUT
but this was not enough to solve, it continue to say that the 1st parameter have some error 🤔
var p = new DynamicParameters();
p.Add("idUser", user.idUser, direction: ParameterDirection.InputOutput);
but this was not enough to solve, it continue to say that the 1st parameter have some error 🤔
Uuselessxp1/31/2023
update: I noticed that I continuosly still get error because standing to the debugger, a dynamic parameter direction can be only input if I use it in a text command (I think it refers to the fact I use text to call the procedure with SQL)
don't understand this but I used a "workaround", I setted the idUser adding a SQL row in the command
don't understand this but I used a "workaround", I setted the idUser adding a SQL row in the command
_dbConnection.Execute($@"
SET @idUser = {user.idUser};
CALL mydb.storedprocedure(@. . . . .)
AAccord2/1/2023
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.