Exemple #1
0
        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.logServer.Add(new LogInfo("Debug", "main->InitDatabase param value" +
                                                 iniPath + " " + info.type + " " + info.ip + " " + info.dbname + " " + info.username + " " + info.password, (int)EnumLogLevel.DEBUG));
                Global.mysqlHelper = new MysqlHelper(info);
            }
            catch (System.Exception ex)
            {
                Global.logServer.Add(new LogInfo("Error", "Main:InitDatabase 初始化数据库失败:" + ex.Message, (int)EnumLogLevel.ERROR));
                return(false);
            }
            return(true);
        }
Exemple #2
0
 public void SetDBInfo(DBInfo info)
 {
     this.LocalDB = info;
 }
Exemple #3
0
 public MysqlHelper(DBInfo dbinfo)
 {
     this.LocalDB = dbinfo;
     ConnectDB();
 }