Note that there are some explanatory texts on larger screens.

plurals
  1. POmySQL stored procedure with .NET connector problem
    primarykey
    data
    text
    <p>I've seen other topics that deal with this error but none that seem to correspond to my situation.</p> <p>First of all, my code works completely fine when i run it locally.</p> <p>But when i upload it to the server, i get the error:</p> <p>Parameter '?PuserName' not found in the collection.</p> <p>Here is the C# code:</p> <pre><code>public DataSet GetEmployeeByUsername(string username) { string proc = "schema.GetEmployeeByUsername"; MySqlParameter[] args = new MySqlParameter[1]; args[0] = new MySqlParameter("?PuserName", MySqlDbType.VarChar); args[0].Value = username; return SQLDatasetCall(args, proc); } protected DataSet SQLDatasetCall(MySqlParameter[] sqlparams, string call) { string myConString = ConfigurationManager.AppSettings["mySql"]; MySqlConnection MyConnection = new MySqlConnection(myConString); MySqlDataAdapter adapter = new MySqlDataAdapter(); MyConnection.Open(); MySqlCommand command = new MySqlCommand(call, MyConnection); command.CommandType = CommandType.StoredProcedure; if (sqlparams != null) { foreach (MySqlParameter param in sqlparams) { command.Parameters.Add(param); } } DataSet ds = new DataSet(); adapter.SelectCommand = command; adapter.Fill(ds); adapter.Dispose(); MyConnection.Close(); return ds; } </code></pre> <p>SQL code:</p> <pre><code>delimiter | create procedure GetEmployeeByUsername(in PuserName varchar(45)) begin select id, firstName, lastName, phone, address1, address2, city, state, zip, username, password, emptypeid from schema.tblemployees where username=PuserName; end | delimiter; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload