private void button1_Click(object sender, EventArgs e) { var sql = richTextBox1.Text; var dt = UtilityData.QueryTable(sql, tbox_exceFile.Text); dataGridView1.DataSource = dt; }
private void btn_select_excelfile_Click(object sender, EventArgs e) { openFileDialog1.ShowDialog(); tbox_exceFile.Text = openFileDialog1.FileName; // new F_tips().Show(); _data = UtilityData.ExcelToDS(tbox_exceFile.Text.Trim()); listBox1.Items.Clear(); foreach (DataTable tb in _data.Tables) { listBox1.Items.Add(tb.TableName); } listBox1.SelectedIndex = 0; }
private void Form1_Load(object sender, EventArgs e) { if (tbox_exceFile.Text == "") { return; } _data = UtilityData.ExcelToDS(tbox_exceFile.Text.Trim()); listBox1.Items.Clear(); foreach (DataTable tb in _data.Tables) { listBox1.Items.Add(tb.TableName); } listBox1.SelectedIndex = 0; }