title: How to connect MySQL database using C# for a log in validation?
body: <p>I've been stuck on this for a couple of days now and I can't seem to find a solution. I am trying to connect to a MySQL database and validate a user for a login page using C# ASP.NET and MVC4. Here's the code I'm trying to use. The debugger gives me the error at at the MysqlDataReader line. The error I get is:</p>
  
  <p>Stored Procedure is:</p>
  
  <pre><code>DELIMITER $$
  
  CREATE DEFINER=`root`@`localhost` PROCEDURE `GetUser`(
  in search varchar (200))
  BEGIN
  SELECT * FROM GetUser
  WHERE id;
  
  END
  </code></pre>
  
  <p>.</p>
  
  <pre><code>public bool isValid(string username, string password) // Used to validate user
      {
          using (MySqlConnection connection = DBConnect.getconnection())
          {
                  using (MySqlCommand cmd = new MySqlCommand("GetUser", connection))
                  {
                      cmd.CommandType = CommandType.StoredProcedure;
  
                      cmd.Parameters.Add(new MySqlParameter("?search", MySqlDbType.VarChar));
  
                      cmd.Parameters["?search"].Value = "%" + "" + "%";
                      cmd.Parameters["?search"].Direction = ParameterDirection.Input;
  
  
                      MySqlDataReader dr = cmd.ExecuteReader();
  
                      if (dr.Read())
                      {
                          Response.Redirect("Index");
                      }
                      else
                      {
                          Response.Redirect("LogIn");
                      }
                  }
  
          }
  
          bool isValid = false;
  
          return isValid;
      }
  </code></pre>
  
  <p>The error I get is:</p>
  
  <p><code>An exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll but was not handled in user code</code></p>
  
  <p><code>Additional information: Table 'systemusers.getuser' doesn't exist</code></p>