//初始化数据库参数及连接 private bool InitDatabase() { try { DBInfo info = new DBInfo(); info.type = IniHelper.GetINIValue(iniPath, "database", "type"); info.ip = IniHelper.GetINIValue(iniPath, "database", "ip"); info.dbname = IniHelper.GetINIValue(iniPath, "database", "name"); info.username = IniHelper.GetINIValue(iniPath, "database", "username"); info.password = IniHelper.GetINIValue(iniPath, "database", "password"); info.port = int.Parse(IniHelper.GetINIValue(iniPath, "database", "port")); Global.mysqlHelper = new MysqlHelper(info); } catch (System.Exception ex) { MessageBox.Show("初始化数据库失败!"); return(false); } return(true); }
public void SetDBInfo(DBInfo info) { this.LocalDB = info; }
public MysqlHelper(DBInfo dbinfo) { this.LocalDB = dbinfo; ConnectDB(); }