C#空重新引用错误[帮助]

时间:2014-05-15 07:18:34

标签: c# mysql nullreferenceexception

我得到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

0 个答案:

没有答案