public void Query(string c) { csConexion cn = new csConexion(); string q = c; try { MySqlCommand cmd = new MySqlCommand(q, cn.getConexion()); cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); cmd.Connection.Close(); } catch (Exception e) { MostrarMensaje("Se encontró el siguente problema " + e.Message); } }
public int QueryReturnInt(string c) { csConexion cn = new csConexion(); string q = c; int i = 0; try { MySqlCommand cmd = new MySqlCommand(q, cn.getConexion()); cmd.CommandType = CommandType.Text; i = Convert.ToInt32(cmd.ExecuteScalar()); cmd.Connection.Close(); } catch (Exception e) { i = 0; MostrarMensaje("Se encontró el siguente problema " + e.Message); } return(i); }
private void button1_Click(object sender, EventArgs e) { csConexion con = new csConexion(); con.getConexion(); }