Source database error

07/23/2013 10:39 LordGragen.#1
hi, i was wondering if you guys can help me solve my problem.

But please explain me the problem a bit that the Consol is telling, i don't want you guys to tell me how to fix it, simply explain me a bit what its saying and i will do my best to fix my self

[Only registered and activated users can see links. Click Here To Register...]

i know its about weapons, and i tested this error pop up every time i wear a weapon, other item are okay, sry i know the error is not that hard its just need someone to explain me the problem.

Code:
 public static string LoadItemString(uint ItemId, string Type)
        {
            using (var m_Conn = Connection)
            {
                try
                {
                    MySqlCommand Command = new MySqlCommand("SELECT " + Type + " FROM items WHERE ItemID='" + ItemId + "'", m_Conn);
                    using (MySqlDataReader rdr = Command.ExecuteReader())
                    {
                        if (rdr.Read())
                        {
                            return rdr[Type].ToString();
                        }
                    }
                    return "0";
                }
                catch (Exception e)
                {
                    FlatDatabase.WriteLine(e);
                    //Database.WriteLine("Failed To ReadItem {0}!", ItemId);
                    return "0";
                }
            }
        }
07/23/2013 10:57 turk55#2
The query that is being used is wrong.
[Only registered and activated users can see links. Click Here To Register...]
07/23/2013 12:11 LordGragen.#3
i love when someone is telling me whats wrong and giving some advice XD making me to look at that code until i come up with something, ty

all i had to do is

change from

Code:
MySqlCommand Command = new MySqlCommand("SELECT " + Type + " FROM items WHERE ItemID='" + ItemId + "'", m_Conn);
to

Code:
MySqlCommand Command = new MySqlCommand("SELECT * FROM items WHERE ItemID='" + ItemId + "'", m_Conn);
07/23/2013 12:43 Arby#4
#closed (requested)