Need help with some lil problems :)

09/05/2008 23:02 $HaDoW#1
Old old old
09/06/2008 00:36 taguro#2
Quote:
Originally Posted by ;1410286
Hi, This is the last step for me to finish my server I need to fix these errors :(
Code:
1#
System.NullReferenceException: Object reference not set to an instance of an object.
   at COServer_Project.DataBase.Authenticate(String UserName, String Password)

2#
System.NullReferenceException: Object reference not set to an instance of an object.
   at COServer_Project.Character.Attack()

3#
System.NullReferenceException: Object reference not set to an instance of an object.
   at COServer_Project.Character.AddItem(String ItemInfo, Byte ToPos, UInt32 UID)
   at COServer_Project.Client.GetPacket(Byte[] data)

4#
MySql.Data.MySqlClient.MySqlException: There is already an open DataReader associated with this Connection which must be closed first.
   at MySql.Data.MySqlClient.MySqlCommand.CheckState()
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
   at COServer_Project.DataBase.SaveChar(Character Charr)
They appear when players do something but I didint find out yet :( an its the last thing I need to fix !
The first 3 require more information, like the sections of code giving you errors, and so does the last, but I can offer some fixes for the last error:

A) Read the data into a dataset, and close the reader. Loop through the dataset and call your function.

B) Loop through the datareader, storing the records you want to log into a list. At the end of the datareader, close it, then post the results from the list.

C) Use two separate connections.

D) I do believe upgrading to SQL Server 2005 and/or SQL Express will also solve this problem.
09/06/2008 07:08 $HaDoW#3
Old old old