private void button1_Click(object sender, EventArgs e) { if (rtb_desc.Text.ToUpper() == "{CONFIRMAR[CORRECAO]}".ToUpper()) { if (panel1.Visible == true) { panel1.Visible = false; } else { panel1.Visible = true; } } else { if (tb_assunto.Text == "" || rtb_desc.Text == "") { MessageBox.Show("Preencha todos os campos corretamente para reportar o bug.", "Atenção!", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { _OldConectStr = Program._ConectionStringMySql; Program._ConectionStringMySql = Program._ConectionStringMySqlOnline; controlarDB.Modificador("Insert into tbl_bugs(assunto,descricao,login,data_reportado) values('" + tb_assunto.Text + "','" + rtb_desc.Text + "','" + Program._LoginUsuario + "',sysdate());", true, "Bug cadastrado com sucesso!"); CarregarGrid(); Program._ConectionStringMySql = _OldConectStr; } } }
public void InsereNoBanco() { string _SQL = "Insert into " + Program._UltimaTabelaSelecionada + " values("; for (int x = 0; x < (dg_inserir.Rows.Count - 1); x++) { for (int y = 0; y < dg_inserir.Columns.Count; y++) { if (y == 0) { _SQL += "'" + dg_inserir.Rows[x].Cells[y].Value + "'"; } else if (y == (dg_inserir.Columns.Count - 1)) { _SQL += ",'" + dg_inserir.Rows[x].Cells[y].Value + "');"; } else { _SQL += ",'" + dg_inserir.Rows[x].Cells[y].Value + "'"; } } ControladoresBD.Modificador(_SQL); _SQL = "Insert into " + Program._UltimaTabelaSelecionada + " values("; } MessageBox.Show("Registros inserios com sucesso!", "Atenção!", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); }
private void button1_Click(object sender, EventArgs e) { if (rtb_comandos.Text == "") { MessageBox.Show("Não foi possível exercutar esse comando.\nInsira um comando válido.", "Erro!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { try { if (rtb_comandos.Text.ToUpper().Substring(0, 6) == "SELECT" || rtb_comandos.Text.ToUpper().Substring(0, 4) == "DESC" || rtb_comandos.Text.ToUpper().Substring(0, 4) == "SHOW") { ControladoresBD.Visualizador(rtb_comandos.Text); TabGrid(); //lsb_ultimos_comandos.Items.Add(rtb_comandos.Text); ListaErro(); } else { ControladoresBD.Modificador(rtb_comandos.Text, true); ListaErro(); } } catch (Exception ex) { lst_CMD_erros.Items.Add(DateTime.Now + ": " + ex.Message, 4); } } }
public void EnviarFeedBack() { _OldConectStr = Program._ConectionStringMySql; Program._ConectionStringMySql = Program._ConectionStringMySqlOnline; controlarDB.Modificador("Insert into tbl_feedback(nota,usuario,comentario,data_feedback,versao) values('" + tk_nota.Value + "','" + Program._LoginUsuario + "','" + rtb_comentario.Text + "',sysdate(),'" + Program._VersaoPrograma + "');", true, "FeedBack enviado com sucesso!"); Program._ConectionStringMySql = _OldConectStr; this.Close(); }
private void excluirBancoDeDadosToolStripMenuItem_Click(object sender, EventArgs e) { if (MessageBox.Show("Deseja realmente excluir este banco de dados?", "Excluir Banco de Dados", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { ControladorBanco CBanco = new ControladorBanco(); CBanco.Modificador("drop database " + tv_bd.SelectedNode.Text + ";"); PreencherTreeViewBancos(_UltimaPosicaoConexao); } }
private void button1_Click(object sender, EventArgs e) { if (rtb_desc.Text.ToUpper() == "{CONFIRMAR[CORRECAO]}".ToUpper()) { if (panel1.Visible == true) { panel1.Visible = false; } else { panel1.Visible = true; } } else { _OldConectStr = Program._ConectionStringMySql; Program._ConectionStringMySql = Program._ConectionStringMySqlOnline; controlarDB.Modificador("Insert into tbl_bugs(assunto,descricao,login,data_reportado) values('" + tb_assunto.Text + "','" + rtb_desc.Text + "','" + Program._LoginUsuario + "',sysdate());", true, "Bug cadastrado com sucesso!"); Program._ConectionStringMySql = _OldConectStr; } }
private void excluirTabelaToolStripMenuItem_Click(object sender, EventArgs e) { if (lv_tabelas.SelectedItems.Count > 0) { if (MessageBox.Show("Deseja realmente excluir esta tabela?", "Excluir Tabela", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { ControladorBanco CBanco = new ControladorBanco(); CBanco.Modificador("Drop Table " + lv_tabelas.SelectedItems[0].Text); CarregaTables(); } } else { MessageBox.Show("Selecione uma tabela antes de excluir!", "Atenção!", MessageBoxButtons.OK, MessageBoxIcon.Warning); excluirTabelaToolStripMenuItem.Enabled = false; } }
public void SQL() { if (_enableCharset == false) { _sintaxeBanco = "CREATE DATABASE " + _nomeBanco + ";"; ControladorBanco controlodorBD = new ControladorBanco(); controlodorBD.Modificador(_sintaxeBanco, true, "Banco de dados criado com sucesso!"); } else { if (_enableColation == false) { _sintaxeBanco = "CREATE DATABASE " + _nomeBanco + "; ALTER DATABASE " + _nomeBanco + " CHARACTER SET " + _charSet + ";"; ControladorBanco controlodorBD = new ControladorBanco(); controlodorBD.Modificador(_sintaxeBanco, true, "Banco de dados criado com sucesso!"); } else { _sintaxeBanco = "CREATE DATABASE " + _nomeBanco + "; ALTER DATABASE " + _nomeBanco + " CHARACTER SET " + _charSet + " COLLATE " + _collate + ";"; ControladorBanco controlodorBD = new ControladorBanco(); controlodorBD.Modificador(_sintaxeBanco, true, "Banco de dados criado com sucesso!"); } } }
public void CriarTabela(string nomeTabela) { string _SQL = ""; _SQL += "CREATE TABLE " + nomeTabela + "("; for (int x = 0; x < dg_tabela.Rows.Count - 1; x++) { try { string NN = ""; string auto_increment = ""; string primary_key = ""; string unsigned = ""; if (dg_tabela.Rows[x].Cells[3].Value != null) { NN = "NOT NULL"; } else { NN = ""; } if (dg_tabela.Rows[x].Cells[4].Value != null) { auto_increment = "AUTO_INCREMENT"; } else { auto_increment = ""; } if (dg_tabela.Rows[x].Cells[5].Value != null) { unsigned = "UNSIGNED"; } else { unsigned = ""; } if (dg_tabela.Rows[x].Cells[6].Value != null) { primary_key = "PRIMARY KEY"; } else { primary_key = ""; } if ((x + 1) == dg_tabela.Rows.Count - 1) { _SQL += dg_tabela.Rows[x].Cells[0].Value + " " + dg_tabela.Rows[x].Cells[1].Value + "(" + dg_tabela.Rows[x].Cells[2].Value + ")" + " " + NN + " " + auto_increment + " " + unsigned + " " + primary_key + ");"; } else { _SQL += dg_tabela.Rows[x].Cells[0].Value + " " + dg_tabela.Rows[x].Cells[1].Value + "(" + dg_tabela.Rows[x].Cells[2].Value + ")" + " " + NN + " " + auto_increment + " " + unsigned + " " + primary_key + ", "; } } catch { } } DBcontrol.Modificador(_SQL, true, "Tabela criada com sucesso!"); }