title: "Connection must be valid and open"
body: <p>i have this error, i have been look at google and in another questions here and i cant find the answer to my problem, this is my code:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.Services;
  using System.Net.Http;
  using System.Web.Http;
  using MySql.Data.MySqlClient;
  
  namespace WebService1
  {
      /// &lt;summary&gt;
      /// Descripción breve de Service1
      /// &lt;/summary&gt;
      [WebService(Namespace = "http://tempuri.org/")]
      [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
      [System.ComponentModel.ToolboxItem(false)]
      // Para permitir que se llame a este servicio web desde un script, usando ASP.NET AJAX, quite la marca de comentario de la línea siguiente. 
      // [System.Web.Script.Services.ScriptService]
      public class Service1 : System.Web.Services.WebService
      {
  
          [WebMethod]
          public string HelloWorld()
          {
              return "Hola a todos";
          }
  
  
          [WebMethod]
          public string ConectarBaseDatos()
          {
              try
              {
                  using (MySqlCommand cm = new MySqlCommand())
                  {
  
                      string connection = @"Data Source=localhost:3306; Database=sistemadatosatletasfecovol; 
                                  User ID=movil; Password=***";
                      MySqlConnection cn = new MySqlConnection(connection);
  
  
                      cm.CommandType = System.Data.CommandType.StoredProcedure;
                      cm.CommandText = "ingresarUsuario";
                      cm.Parameters.Add("_email", MySqlDbType.VarChar).Value = "asdasd@gmail.com";
                      cm.Parameters.Add("_password", MySqlDbType.VarChar).Value = "******";
                      cm.Connection = cn;
                      cm.ExecuteNonQuery();
                      MySqlDataReader cr = cm.ExecuteReader();
                      cr.Read();
                      string id;
                      id = cr["idUsuario"].ToString();
                      return id;
                  }
              }
              catch (Exception ex)
              {
                  return ex.ToString();
              }
          }
      }
  }
  </code></pre>
  
  <p>on the web Method "ConectarBaseDatos" and the problem appear when i execute <code>cm.ExecuteNonQuery()</code>;</p>