static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //数据库连接 var connectionString = ConfigurationManager.ConnectionStrings["DataConnectionString"].ConnectionString; DBConnectHelper.SetConnection(connectionString); Application.Run(new MainForm()); }
/// <summary> /// 更新数据库信息 /// </summary> private void UpdateDBConnection() { var initDb = new DBConfig { DataServer = this.txtInitDbServer.Text.Trim(), DataBase = this.txtInitDbName.Text.Trim(), LoginAccount = this.txtInitDbAccount.Text.Trim(), Password = this.txtInitDbPwd.Text.Trim() }; var downDb = new DBConfig { DataServer = this.txtDownDbServer.Text.Trim(), DataBase = this.txtDownDbName.Text.Trim(), LoginAccount = this.txtDownDbAccount.Text.Trim(), Password = this.txtDownDbPwd.Text.Trim() }; DBConnectHelper.SetConnection(initDb, downDb); }