我得到NullReferenceException: Object reference not set to an instance of a object error
在运行当前函数时。数据库作业表,
public Dictionary<uint ,JobsFacotry> Jobs = new Dictionary<uint,JobsFacotry>();
internal void LoadJobs(IQueryAdapter dbclient)
{
dbclient.setQuery("SELECT * FROM jobs");
DataTable jobs = dbclient.getTable();
if (jobs != null)
{
Jobs.Clear();
foreach (DataRow rows in jobs.Rows)
{
Jobs.Add((uint)rows["job_id"], new JobsFacotry((uint)rows["job_id"],
(uint)rows["room_id"], (string)rows["job_name"],
(string)rows["jobbadge"]));
}
}
}
当我将字段添加到数据库时,错误位于行但是它们是正确的http://prntscr.com/3jd7ud