Exemplo n.º 1
0
 public void excluirRegistro(Reagente re)
 {
     try
     {
         conexao = new MySqlConnection(caminho);
         conexao.Open();
         string       alterar = "DELETE FROM registro WHERE cod = '" + re.Codigo + "'";
         MySqlCommand comando = new MySqlCommand(alterar, conexao);
         comando.ExecuteNonQuery();
         conexao.Close();
     }
     catch (Exception ex)
     {
         throw new Exception("Erro de comandos: " + ex.Message);
     }
 }
Exemplo n.º 2
0
 public void cadastro(Reagente re)
 {
     try
     {
         conexao = new MySqlConnection(caminho);
         conexao.Open();
         string       inserir  = "INSERT INTO reagente(reagente, armario, lab)VALUES('" + re.Reagentes + "','" + re.Armario + "','" + re.Laboratorio + "')";
         MySqlCommand comandos = new MySqlCommand(inserir, conexao);
         comandos.ExecuteNonQuery();
         conexao.Close();
     }
     catch (Exception ex)
     {
         throw new Exception("Erro de comandos: " + ex.Message);
     }
 }
Exemplo n.º 3
0
 public void atualizar(Reagente re)
 {
     try
     {
         conexao = new MySqlConnection(caminho);
         conexao.Open();
         string       alterar  = "UPDATE reagente SET reagente ='" + re.Reagentes + "', armario = '" + re.Armario + "', lab = '" + re.Laboratorio + "' WHERE cod = '" + re.Codigo + "' AND lab='" + re.Laboratorio + "'";
         MySqlCommand comandos = new MySqlCommand(alterar, conexao);
         comandos.ExecuteNonQuery();
         conexao.Close();
     }
     catch (Exception ex)
     {
         throw new Exception("Erro de comandos: " + ex.Message);
     }
 }
Exemplo n.º 4
0
 public void cadastroRegistro(Reagente re)
 {
     try
     {
         conexao = new MySqlConnection(caminho);
         conexao.Open();
         string       inserir  = "INSERT INTO registro(data, registro)VALUES('" + Convert.ToDateTime(re.Data).ToString("yyyy-MM-dd") + "','" + re.Registro + "')";
         MySqlCommand comandos = new MySqlCommand(inserir, conexao);
         comandos.ExecuteNonQuery();
         conexao.Close();
     }
     catch (Exception ex)
     {
         throw new Exception("Erro de comandos: " + ex.Message);
     }
 }
Exemplo n.º 5
0
 public DataTable Reagente(Reagente re)
 {
     try
     {
         conexao = new MySqlConnection(caminho);
         conexao.Open();
         string           selecionar = "SELECT cod, reagente, armario, lab FROM reagente where reagente LIKE '%" + re.Reagentes + "%'AND lab='" + re.Laboratorio + "' order by reagente";
         MySqlDataAdapter comandos   = new MySqlDataAdapter(selecionar, conexao);
         DataTable        dt         = new System.Data.DataTable();
         comandos.Fill(dt);
         conexao.Close();
         return(dt);
     }
     catch (Exception ex)
     {
         throw new Exception("Erro de comandos: " + ex.Message);
     }
 }