I've decided to learn the ropes of coding step by step so I took out a fresh copy of the impulse source and began coding on it(just recently). I coded nobility(parts from another reference), but the MySqlReader is giving me problems while I load up the console.
These are my variables at the top:
Code:
private DataSet _dataset;
private DataRow _datarow;
private int _row;
const string Table = "table";
Code:
public bool Read()
{
if (_dataset != null && _dataset.Tables[Table].Rows.Count > _row)
{
_datarow = _dataset.Tables[Table].Rows[_row];
_row++;
return true;
}
_row++;
return false;
}
I get an error now saying:
Line 24 NobilityTable.cs is this:Quote:
Object Reference not set to an instance of an Object.
Code:
reader.Close();
Code:
public static void Load()
{
MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("nobility");
MySqlReader reader = new MySqlReader(cmd);
while (reader.Read())
{
Game.ConquerStructures.NobilityInformation nobilityinfo = new Conquer_Online_Server.Game.ConquerStructures.NobilityInformation();
nobilityinfo.EntityUID = reader.ReadUInt32("EntityUID");
nobilityinfo.Name = reader.ReadString("EntityName");
nobilityinfo.Donation = reader.ReadUInt64("Donation");
nobilityinfo.Gender = reader.ReadByte("Gender");
nobilityinfo.Mesh = reader.ReadUInt32("Mesh");
Game.ConquerStructures.Nobility.Board.Add(nobilityinfo.EntityUID, nobilityinfo);
}
reader.Close();
Game.ConquerStructures.Nobility.Sort(0);
Console.WriteLine("Nobility information loaded.");
}
Code:
public void Close()
{
_dataset.Clear();
}
I would appreciate a little help pointing me in the right direction, sorry for my "newb-ness" but I wanted to know what is causing this and why.
Regards, killersub.







