public bool UpdateSettings(Settings settings) { try { MySqlConnection theconnection = Connect(); settings.RRSaddress = settings.RRSaddress.Replace("'", ""); settings.RRSHeaderFile = settings.RRSHeaderFile.Replace("\\", "\\\\"); settings.RRSLinesFile = settings.RRSLinesFile.Replace("\\", "\\\\"); string updatequery = "UPDATE settings SET `RRSaddress`='" + settings.RRSaddress + "',`RRSlatitude`=" + settings.RRSlatitude + ",`RRSlongitude`=" + settings.RRSlongitude + ",`Mapquest`='" + settings.mapquestkey + "',`RRSLinesFile`='" + settings.RRSLinesFile + "',`RRSHeaderFile`='" + settings.RRSHeaderFile + "',`password`='" + settings.passwordhash + "';"; Update(updatequery, theconnection); Disconnect(); return true; } catch { Disconnect(); return false; } }
public Settings GetSettings() { try { MySqlConnection theconnection = Connect(); MySqlDataReader rdr = Select("SELECT * FROM settings;", theconnection); rdr.Read(); Settings settings = new Settings((string)rdr[0], (float)rdr[1], (float)rdr[2], (string)rdr[3], (string)rdr[4], (string)rdr[5], (string)rdr[6]); Disconnect(); return (settings); } catch { Disconnect(); return null; } }