Help with this Plz

03/27/2009 18:21 Petetoft99#1
Ok the Code below is my SaveChar some reason it keeps Crashing the server think someone can help me with this? Command.ExecuteNonQuery();<<<<<IS line 318 in my Database.cs makes it crash


public static void SaveChar(Character Charr)
{
try
{
Reader.Close();
Charr.PackInventory();
Charr.PackEquips();
Charr.PackSkills();
Charr.PackProfs();
Charr.PackWarehouses();
Charr.PackEnemies();
Charr.PackFriends();
MySqlCommand Command = new MySqlCommand("UPDATE `Characters` SET `CharName` = '" + Charr.Name + "',`DoubleExp` = '" + Charr.DExp2 + "', `Level` = " + Charr.Level + ",`Exp` = " + Charr.Exp.ToString() + /*"', `OfflineTG` = " + Charr.OfflineTG +*/ ",`GuildDonation` = " + Charr.GuildDonation + ",`Strength` = " + Charr.Str + ",`Agility` = " + Charr.Agi + ",`Vitality` = " + Charr.Vit + ",`Spirit` = " + Charr.Spi + ",`Job` = " + Charr.Job + ",`Model` = " + Charr.RealModel + ",`Money` = " + Charr.Silvers + ",`CPs` = " + Charr.CPs + ",`CurrentHP` = " + Charr.CurHP + ",`StatPoints` = " + Charr.StatP + ",`MyGuild` = " + Charr.GuildID + ",`GuildPos` = " + Charr.GuildPosition + ",`LocationMap` = " + Charr.LocMap + ",`LocationX` = " + Charr.LocX + ",`LocationY` = " + Charr.LocY + ",`Hair` = " + Charr.Hair + ",`Equipment` = '" + Charr.PackedEquips + "',`Inventory` = '" + Charr.PackedInventory + "',`PKPoints` = " + Charr.PKPoints + ",`PrevMap` = " + Charr.PrevMap + ", `Skills` = '" + Charr.PackedSkills + "', `Profs` = '" + Charr.PackedProfs + "',`RBCount` = " + Charr.RBCount + ",`Avatar` = " + Charr.Avatar + ",`WHMoney` = " + Charr.WHSilvers + ",`VP` = " + Charr.VP + ",`Warehouses` = '" + Charr.PackedWHs + "',`Friends` = '" + Charr.PackedFriends + "',`Enemies` = '" + Charr.PackedEnemies + "',`QuestMob` = '" + Charr.QuestMob + "',`QuestKO` = " + Charr.QuestKO + ",`CurrentMP` = " + Charr.CurMP + ",`PrevJob` = " + Charr.PrevJob + ",`LuckyTime` = '" + Charr.LuckyTime + "' WHERE `Account` = '" + Charr.MyClient.Account + "';", Database.Connection);
Command.ExecuteNonQuery();<<<<<IS line 318 in my Database.cs makes it crash
}
catch (Exception Exc)
{
General.WriteLine(Convert.ToString(Exc));
if (World.SaveAllChars())
{
General.WriteLine("Connection to mysql server reinitiated");
}
else
{
General.WriteLine("Connection Error, server restarting! " + DateTime.Now);
General.ServerRestart();
}
}
}
03/27/2009 18:29 andyd123#2
If you want help with this, you'll have to post the exact error that is being thrown, and not just the line it is on.
With this error it is possible to determine what the actual problem is.

Thanks,

Andy
03/27/2009 18:37 L1nk1n*P4rK#3
Becouse Is LOFT I Will Help You:

The Problem Is In DataBase.cs
At line:
Code:
MySqlCommand Command = new MySqlCommand("UPDATE `Characters` SET `CharName` = '" + Charr.Name + "',`DoubleExp` = '" + Charr.DExp2 + "', `Level` = " + Charr.Level + ",`Exp` = " + Charr.Exp.ToString() + /*"', `OfflineTG` = " + Charr.OfflineTG +*/ ",`GuildDonation` = " + Charr.GuildDonation + ",`Strength` = " + Charr.Str + ",`Agility` = " + Charr.Agi + ",`Vitality` = " + Charr.Vit + ",`Spirit` = " + Charr.Spi + ",`Job` = " + Charr.Job + ",`Model` = " + Charr.RealModel + ",`Money` = " + Charr.Silvers + ",`CPs` = " + Charr.CPs + ",`CurrentHP` = " + Charr.CurHP + ",`StatPoints` = " + Charr.StatP + ",`MyGuild` = " + Charr.GuildID + ",`GuildPos` = " + Charr.GuildPosition + ",`LocationMap` = " + Charr.LocMap + ",`LocationX` = " + Charr.LocX + ",`LocationY` = " + Charr.LocY + ",`Hair` = " + Charr.Hair + ",`Equipment` = '" + Charr.PackedEquips + "',`Inventory` = '" + Charr.PackedInventory + "',`PKPoints` = " + Charr.PKPoints + ",`PrevMap` = " + Charr.PrevMap + ", `Skills` = '" + Charr.PackedSkills + "', `Profs` = '" + Charr.PackedProfs + "',`RBCount` = " + Charr.RBCount + ",`Avatar` = " + Charr.Avatar + ",`WHMoney` = " + Charr.WHSilvers + ",`VP` = " + Charr.VP + ",`Warehouses` = '" + Charr.PackedWHs + "',`Friends` = '" + Charr.PackedFriends + "',`Enemies` = '" + Charr.PackedEnemies + "',`QuestMob` = '" + Charr.QuestMob + "',`QuestKO` = " + Charr.QuestKO + ",`CurrentMP` = " + Charr.CurMP + ",`PrevJob` = " + Charr.PrevJob + ",`LuckyTime` = '" + Charr.LuckyTime + "' WHERE `Account` = '" + Charr.MyClient.Account + "';", Database.Connection);
Command.ExecuteNonQuery();
Now why you are gething this problem?
Becouse the server want to Save your Character but the DB (From MySQL) dont contain 1 (or more) from this Tables.