public void inserirVacina(Vacina vacina) { using (OdbcConnection conexao = ConexaoPadrao.createConnection()) { string sql = "insert into VACINA (ID_VACINA, ID_ANIMAL, ID_MEDICAMENTO, DATA) values(?,?,?,?)"; OdbcCommand command = new OdbcCommand(sql, conexao); command.Parameters.AddWithValue("@ID_VACINA", vacina.id); command.Parameters.AddWithValue("@ID_ANIMAL", vacina.idAnimal); command.Parameters.AddWithValue("@ID_MEDICAMENTO", vacina.idMedicamento); command.Parameters.AddWithValue("@DATA", vacina.data); conexao.Open(); command.ExecuteNonQuery(); } }
public void alteraVacina(Vacina vacina) { using (OdbcConnection conexao = ConexaoPadrao.createConnection()) { string sql = "update VACINA set ID_ANIMAL = ?, ID_MEDICAMENTO = ?, DATA = ?, where ID_VACINA = ?"; OdbcCommand command = new OdbcCommand(sql, conexao); command.Parameters.AddWithValue("@ID_ANIMAL", vacina.idAnimal); command.Parameters.AddWithValue("@ID_MEDICAMENTO", vacina.idMedicamento); command.Parameters.AddWithValue("@DATA", vacina.data); command.Parameters.AddWithValue("@ID_VACINA", vacina.id); conexao.Open(); command.ExecuteNonQuery(); } }