bool LoadSysConfig() { INIDBConfig i = new INIDBConfig(); string DBCode = i.GetDBCode(); string ConnnectionString = i.GetConnStr(); string ProviderName = i.GetProviderName(); var validate = DatabaseFactory.Validate(ConnnectionString, ProviderName); if (validate == true) { CommonData.DBCode = DBCode; var v = DatabaseFactory.CreateDatabase(ConnnectionString, ProviderName); dic.Add(DBCode, v); } return validate; }
private void btn_OK_Click(object sender, EventArgs e) { if (uc == null) return; if (String.IsNullOrEmpty(txt_DBCode.Text)) { txt_DBCode.ErrorText = "数据库别名不能为空!"; return; } var db = uc.DoConfig(); if (db == null) return; //MessageBox.Show(db.GetConnectionStr()); INIDBConfig i = new INIDBConfig(); i.SetDBCode(txt_DBCode.Text); i.SetConnStr(db.GetConnectionStr()); i.SetProviderName(db.ProviderName); this.DialogResult = DialogResult.OK; this.Close(); }