private void button1_Click(object sender, RoutedEventArgs e) //查看数据表 { dw = new dataWindow(); dw.Show(); Tools.showDatabase(dw.dataGrid, listBox.SelectedItem.ToString(), 0); status_text.Text = listBox.SelectedItem.ToString(); }
private void mytest_button_Click(object sender, RoutedEventArgs e) //test按钮 { //设置数据库连接 if (dataBaseName_text.Text.Equals("") == false) //如果数据库名称不为空,否则使用默认连接 { MySqlHelper.Conn = "Database='" + dataBaseName_text.Text + "';Data Source='localhost';User Id='root';Password='******';charset='utf8';pooling=true"; } //清空数据表 for (int i = 0; i < listBox.Items.Count; i++) { listBox.Items.RemoveAt(i); } //重新获取数据表 DataTable dt = Tools.getDataTable("show tables", 0); listBox.Items.Add("数据库中现有的表有:"); for (int i = 0; i < dt.Rows.Count; i++) { listBox.Items.Add(dt.Rows[i][0]); } //显示查询窗口 dw = new dataWindow(); dw.Show(); }
/// <summary> /// 弹出Preview窗体,预览DataTable的数据 /// </summary> /// <param name="dt"></param> public static void previewDataTable(DataTable dt) { dataWindow dw = new dataWindow(dt); //显示dt查询结果 dw.Show(); //显示查询结果 }