예제 #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.mysqlHelper = new MysqlHelper(info);
     }
     catch (System.Exception ex)
     {
         MessageBox.Show("初始化数据库失败!");
         return(false);
     }
     return(true);
 }
예제 #2
0
 public void SetDBInfo(DBInfo info)
 {
     this.LocalDB = info;
 }
예제 #3
0
 public MysqlHelper(DBInfo dbinfo)
 {
     this.LocalDB = dbinfo;
     ConnectDB();
 }