/// <summary> /// 从数据库里读取装置信息 /// </summary> public void SYSSQL() { SYSConnString = ""; SYS_DATABASETable = ""; INI_IO ini_io = new INI_IO(); if (ini_io.IniFiles(StartupPath + "\\sys_setting.ini")) { string sysA = ini_io.ReadString("Section", "SYSSERVER_ADDRESS", ""); string sysport = ini_io.ReadString("Section", "SYS_PORT", ""); string sysuser = ini_io.ReadString("Section", "SYS_USERNAME", ""); string syspwd = ini_io.ReadString("Section", "SYS_PASSWORD", ""); string IsSYSSqlServer = ini_io.ReadString("Section", "SYS_SQLSERVER", ""); string strSYSDatabase = ""; if (IsSYSSqlServer == "1") { strSYSDatabase = ini_io.ReadString("Section", "SYS_DATABASENAME", ""); SYS_DATABASETable = ini_io.ReadString("Section", "SYS_DATABASETable", ""); } else if (IsSYSSqlServer == "0") { strSYSDatabase = ini_io.ReadString("Section", "SYS_DATABASEFILENAME", ""); } SYSConnString = "Provider=SQLOLEDB;Server=" + sysA + "," + sysport + ";Database=" + strSYSDatabase + ";Persist Security Info=False;uid=" + sysuser + ";pwd=" + syspwd + ";"; } else { //MessageBox.Show("没有配置文件!"); } }
public void ReadINI() { INI_IO ini_io = new INI_IO(); if (ini_io.IniFiles(StartupPath + "\\sys_setting.ini")) { strServer = ini_io.ReadString("Section", "SERVER_ADDRESS", ""); strPort = ini_io.ReadString("Section", "DB_PORT", ""); struid = ini_io.ReadString("Section", "DB_USERNAME", ""); strpwd = ini_io.ReadString("Section", "DB_PASSWORD", ""); IsSqlServer = ini_io.ReadString("Section", "IS_SQLSERVER", ""); if (IsSqlServer == "1") { } //strDatabase = ini_io.ReadString("Section", "DB_DATABASENAME", ""); else if (IsSqlServer == "0") { strDatabase = ini_io.ReadString("Section", "DB_DATABASEFILENAME", ""); } strRServer = ini_io.ReadString("Section", "RSERVER_ADDRESS", ""); strRPort = ini_io.ReadString("Section", "RDB_PORT", ""); strRuid = ini_io.ReadString("Section", "RDB_USERNAME", ""); strRpwd = ini_io.ReadString("Section", "RDB_PASSWORD", ""); IsRSqlServer = ini_io.ReadString("Section", "RIS_SQLSERVER", ""); if (IsRSqlServer == "1") { } //strRDatabase = ini_io.ReadString("Section", "RDB_DATABASENAME", ""); else if (IsRSqlServer == "0") { strRDatabase = ini_io.ReadString("Section", "RDB_DATABASEFILENAME", ""); } } else { //MessageBox.Show("没有配置文件!"); } }
public int ReadID() { INI_IO ini_io = new INI_IO(); if (ini_io.IniFiles(CommonStr.physicalPath + "\\sys_setting.ini")) { string strID = ini_io.ReadString("Section", "ID", ""); if (strID == "") { return(-1); } else { int ID = Int32.Parse(strID); ID += 1; ini_io.WriteString("Section", "ID", "" + ID); return(ID); } } else { return(-1); } }