Named Parameters Prefix problem

Named Parameters Prefix problem

Postby lkrueger » 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
Code: Select all
CREATE PROCEDURE pGetUserSalt(uname varchar(16), OUT salt varchar(32))
Begin
   Set salt = (Select uSalt From tblUsers Where uUsername=uname);
End


and here is my part of the code to retrieve the salt
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);


Any idea why '@' doesn't work?! Any help would be appreciated. Thanks!
lkrueger
 
Posts: 6
Joined: Mon 14 Jul 2014 17:40

Re: Named Parameters Prefix problem

Postby Pinturiccio » Wed 16 Jul 2014 15:32

This is designed behaviour. If you use CommandType.StoredProcedure, you can use any parameter names, however, the prefix '@' must not be used. We will add the information about this prefix in our documentation.
Pinturiccio
Devart Team
 
Posts: 1982
Joined: Wed 02 Nov 2011 09:44

Re: Named Parameters Prefix problem

Postby lkrueger » Wed 16 Jul 2014 16:42

Thanks for the info
lkrueger
 
Posts: 6
Joined: Mon 14 Jul 2014 17:40


Return to dotConnect for MySQL