public void AgregarParametrizacion(EParametrizar eParametros) { string ipAddress = Ip.GetIP(); string MacAddress = Mac.GetMACAddress2(); DataTable Autor = new DataTable(); MySqlConnection conection = new MySqlConnection(ConfigurationManager.ConnectionStrings["Mybd"].ConnectionString);//procede la conexion llamada "Mybd" ver web.config try { conection.Open(); //abre coneccion MySqlCommand command = new MySqlCommand("sp_parametrizar", conection); //crea objeto para llamar el proceso almacenado command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("_dias", MySqlDbType.Int32).Value = eParametros.Dias; command.Parameters.Add("_valor", MySqlDbType.Int64).Value = eParametros.Valor; command.Parameters.Add("_libros", MySqlDbType.Int32).Value = eParametros.LibrosPrest; command.ExecuteNonQuery(); } catch (Exception e) { throw e; } finally { if (conection != null) { conection.Close(); } } }
protected void Button1_Click(object sender, EventArgs e) { EParametrizar eParametros = new EParametrizar(); eParametros.Dias = Int32.Parse(TB_Dias.Text.ToString()); eParametros.Valor = Int64.Parse(TB_Valor.Text.ToString()); eParametros.LibrosPrest = Int32.Parse(TB_Libros.Text.ToString()); DAParametrizar dParametrizar = new DAParametrizar(); dParametrizar.AgregarParametrizacion(eParametros); TB_Dias.Text = ""; TB_Libros.Text = ""; TB_Valor.Text = ""; GridView1.DataBind(); }