public static void getxml() { try { string file = Application.StartupPath + "\\" + "bgkj.exe.config"; ExeConfigurationFileMap map = new ExeConfigurationFileMap(); map.ExeConfigFilename = file; Configuration config = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None); SQLHelper.connstr = Des.DesDecrypt(config.ConnectionStrings.ConnectionStrings["ConStr"].ConnectionString); } catch { MessageBox.Show("读取配置文件错误,或无配置信息,请写入新的配置信息!"); Application.Exit(); } }
private void GetFtpInfo() { try { string strSql = "select * from M_FtpInfo "; DataTable dt = SQLHelper.ExcuteTable(strSql); DataRow dr = dt.Rows[0]; FtpIp = dr["IP"].ToString(); FtpPort = Convert.ToInt16(dr["Port"]); FtpUser = dr["UserName"].ToString(); FtpPwd = Des.DesDecrypt1(dr["PWD"].ToString()); FtpPath = dr["ArchSave"].ToString(); Frmgetup.ftppath = dr["UpdatePath"].ToString(); Frmgetup.id = 1; } catch { Frmgetup.id = 0; } }