Help on Flowers...

02/25/2010 08:01 5supertao#1
Im adding public static void SaveFlowerRank to Database.cs

and its saying this.

Code:
Error	1	The name 'GetConnection' does not exist in the current context	C:\Documents and Settings\Administrator\My Documents\Fixed Source\rikardo updated\Database.cs	317	36	NewestCOServer

Im using this code... i use 5165

Code:
        public static void SaveFlowerRank(Game.Character C)
        {
            MySqlConnection Conn = GetConnection();
            bool exist = false;
            string Name = C.Name;

            if (Name.Contains("[PM]"))
                Name.Replace("[PM]", "");

            try
            {
                lock (Conn)
                {
                    MySqlCommand Cmd = new MySqlCommand("SELECT * FROM `cq_flowers` WHERE `charuid2` = '" + C.Name + "'", Conn);
                    MySqlDataReader DR = Cmd.ExecuteReader();

                    while (DR.Read())
                    {
                        exist = true;
                    }
                    DR.Close();
                }
                lock (Conn)
                {
                    Struct.Flowers F = C.Flowers;
                    if (exist)
                    {
                        MySqlCommand Cmd = new MySqlCommand("UPDATE `cq_flowers` SET `redroses` = " + F.RedRoses + ", `redrosestoday` = " + F.RedRoses2day + ",`lilies` = " + F.Lilies + ",`liliestoday` = " + F.Lilies2day + ",`redrosestoday` = " + F.Tulips + ",`redrosestoday` = " + F.Tulips2day + ",`orchads` = " + F.Orchads + ",`orchadstoday` = " + F.Orchads2day + ", WHERE `charuid2` = \"" + Name + "\"", Conn);
                        Cmd.ExecuteNonQuery();
                    }
                    else
                    {
                        MySqlCommand Cmd = new MySqlCommand("INSERT INTO `cq_flowers` (redroses, redrosestoday, lilies, liliestoday, tulips, tulipstoday, orchads, orchadstoday, charuid, charuid2) VALUES (" + F.RedRoses + "," + F.RedRoses2day + "," + F.Lilies + "," + F.Lilies2day + "," + F.Tulips + "," + F.Tulips2day + "," + F.Orchads + "," + F.Orchads2day + "," + C.EntityID + ",'" + Name + "')", Conn);
                        Cmd.ExecuteNonQuery();
                    }
                }
                lock (Conn)
                {
                    string Save = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day;
                    MySqlCommand Cmd = new MySqlCommand("UPDATE `cq_saves` SET `save_flower` = " + Save + " WHERE `type` = 0", Conn);
                    Cmd.ExecuteNonQuery();
                }
                Conn.Close();
            }
            catch (Exception ex) { Console.WriteLine(ex.ToString()); Conn.Close(); return; }
        }
02/26/2010 10:40 12tails#2
GetConnection is the void that you use to connect on the database...