private void btnVoltrBkp_Click(object sender, EventArgs e) { painelVolta.Visible = true; OpenFileDialog f = new OpenFileDialog(); if ( f.ShowDialog() == System.Windows.Forms.DialogResult.OK) { SqlLite sql = new SqlLite(dataBase); string arquivo = f.FileName; string[] lines = System.IO.File.ReadAllLines(arquivo); txtTotalLinhas.Text = lines.Length.ToString(); int total = 0; foreach (string line in lines) { txtLinhaAtual.Text = (total++).ToString(); if (!string.IsNullOrEmpty(line.Trim())) { try { sql.execQuery(line); // txtExecute.Text = line; } catch (Exception ex) { txtExecute.Text += string.Format("Erro: {0} Linha: {1} {2}",ex.Message, line, Environment.NewLine); } } } sql.close(); } }
private void listaTabelas() { dtgListar.DataSource = null; dtgListar.AutoGenerateColumns = false; dtgListar.Columns["colNome"].DataPropertyName = "NAME"; SqlLite sql = new SqlLite(dataBase); dtgListar.DataSource = sql.execQuery("SELECT NAME FROM sqlite_master WHERE type = \"table\""); sql.close(); }
private void btnExecute_Click(object sender, EventArgs e) { SqlLite sql = new SqlLite(dataBase); dtgSelect.DataSource = sql.execQuery(txtExecute.Text); sql.close(); }