views:

436

answers:

1

I've seen other topics that deal with this error but none that seem to correspond to my situation.

First of all, my code works completely fine when i run it locally.

But when i upload it to the server, i get the error:

Parameter '?PuserName' not found in the collection.

Here is the C# 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;
        }

SQL 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;
+1  A: 

turned out microsoft Visual Web Developer wasn't correctly ftp-ing my files during the "publish" method. i downloaded filezilla and ftp-ed the files again and it worked....

Micah