void GetMsTable(string dbName) { if (string.IsNullOrWhiteSpace(dbName)) { string msg = "请选择数据库"; KryptonMessageBox.Show(msg, "警告" , MessageBoxButtons.OK, MessageBoxIcon.Error); return; } AutoUtil au = new AutoUtil(); string sql = SqlDict["TBS"]; DataTable dt = au.GetTables(dbName, sql); if (dt != null && dt.Rows.Count > 0) { this.kryLbxDbTb.DataSource = dt; this.kryLbxDbTb.DisplayMember = "name"; this.kryLbxDbTb.ValueMember = "name"; this.kryLbxDbTb.SelectedIndex = -1; string tip = "共有用户表{0}个."; this.kryLblDbTip.Text = string.Format(tip, dt.Rows.Count.ToString()); } else { KryptonMessageBox.Show("获取不到当前数据库的用户表!" , "警告", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
DataTable GetMsField() { AutoUtil au = new AutoUtil(); string sql = SqlDict["FDS"]; DataTable fdDT = au.GetFields(ao.DbName, ao.TbName, sql); return(fdDT == null ? new DataTable() : fdDT); }
bool GetMsDatabase() { try { AutoUtil au = new AutoUtil(); string sql = SqlDict["DBS"]; DataTable dt = au.GetDatabases(sql); this.kryCbxDb.DataSource = dt; this.kryCbxDb.DisplayMember = "name"; this.kryCbxDb.ValueMember = "name"; this.kryCbxDb.SelectedIndex = 0; return true; } catch (Exception) { KryptonMessageBox.Show("连接不到master数据库信息!\r\n1)请确认数据库连接配置是否正确!\r\n2)请确认SQLServer服务是否已启用!" , "警告", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } }
bool GetMsDatabase() { try { AutoUtil au = new AutoUtil(); string sql = SqlDict["DBS"]; DataTable dt = au.GetDatabases(sql); this.kryCbxDb.DataSource = dt; this.kryCbxDb.DisplayMember = "name"; this.kryCbxDb.ValueMember = "name"; this.kryCbxDb.SelectedIndex = 0; return(true); } catch (Exception) { KryptonMessageBox.Show("连接不到master数据库信息!\r\n1)请确认数据库连接配置是否正确!\r\n2)请确认SQLServer服务是否已启用!" , "警告", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }
DataTable GetMsField() { AutoUtil au = new AutoUtil(); string sql = SqlDict["FDS"]; DataTable fdDT = au.GetFields(ao.DbName, ao.TbName, sql); return fdDT == null ? new DataTable() : fdDT; }