//sql字段补全功能界面 private void Sql_button_Click(object sender, EventArgs e) { //读取下ini配置 IniFiles ini = new IniFiles(Directory.GetCurrentDirectory() + @"\ini\mysqlconfig.ini"); if (ini.ReadSections().Count == 0) { MessageBox.Show("请先添加数据库配置!"); SqlConfigForm sqlConfigForm = new SqlConfigForm(); sqlConfigForm.Show(); return; } List <string> SqlInitInfo = ini.GetSelectedSqlConfig(); if (SqlInitInfo == null) { MessageBox.Show("请先应用一个数据库配置!"); SqlConfigForm sqlConfigForm = new SqlConfigForm(); sqlConfigForm.Show(); return; } SqlForm sqlform = new SqlForm(); sqlform.Show(); }
private void SqlForm_Load(object sender, EventArgs e) { //读取下ini配置 IniFiles ini = new IniFiles(Directory.GetCurrentDirectory() + @"\ini\mysqlconfig.ini"); SqlInitInfo = ini.GetSelectedSqlConfig(); if (SqlInitInfo == null) { MessageBox.Show("请先添加数据库配置!"); SqlConfigForm sqlConfigForm = new SqlConfigForm(); sqlConfigForm.Show(); return; } //连接数据库 if (myso.MySqlConncet(SqlInitInfo) == null) { MessageBox.Show("连接数据库失败,请检查数据库配置是否正确。"); return; } //string sText = "show databases"; //读取数据库列表 DataSet ds = myso.MySqlCommand_GetDataSet(SqlInitInfo, "show databases"); SqlDatabase_ListBox.DataSource = ds.Tables[0]; SqlDatabase_ListBox.DisplayMember = ds.Tables[0].Columns[0].ToString(); //设置默认选择项 SetListBoxSelectItem(SqlInitInfo[3]); }
private void ToolStripMenuItem1_Click(object sender, EventArgs e) { SqlConfigForm sqlConfigForm = new SqlConfigForm(); sqlConfigForm.ShowDialog(); }