Named Parameters Prefix problem
Posted: Mon 14 Jul 2014 17:51
Hi! I recently switched from the mySql net/connector to dotConnect and am having an issue with Stored Procedures and named Parameters. I've read the documentation, however what it says does not seem to be what it does, I'm guessing I'm missing a finer point.
I would like to use the '@' prefix for named parameters so I don't have to change a lot of code, however I can only get them to work using the ':' prefix or no prefix at all
Here is my stored procedure
and here is my part of the code to retrieve the salt
Any idea why '@' doesn't work?! Any help would be appreciated. Thanks!
I would like to use the '@' prefix for named parameters so I don't have to change a lot of code, however I can only get them to work using the ':' prefix or no prefix at all
Here is my stored procedure
Code: Select all
CREATE PROCEDURE pGetUserSalt(uname varchar(16), OUT salt varchar(32))
Begin
Set salt = (Select uSalt From tblUsers Where uUsername=uname);
End
Code: Select all
MySqlCommand cmd = new MySqlCommand()
{
CommandText = "pGetUserSalt",
Connection = conn,
CommandType = CommandType.StoredProcedure
};
cmd.Parameters.AddWithValue("@uname", _username);
MySqlParameter pSalt = new MySqlParameter()
{
ParameterName = "@salt",
Direction = ParameterDirection.Output,
MySqlType = MySqlType.VarChar,
Size = 32
};
cmd.Parameters.Add(pSalt);