开发者

Column does not belong to table

I've a web site project with .NET Framework 2.0. The problem is "Column 'picPath' does not belong to table." But this error not always occurs.

Here is my code :

public void getAdvertisement()
{
  List<ListItem> AdvList = new List<ListItem>();
  AdvList.Add(new ListItem("@a","notList"));
  DataTable dt = new DataTable();
  dt = BLAtom.GetByDataTable("spAdvertisementGetAll", AdvList);      
  if (dt.Rows.Count > 0)
  {          
      reklam1 = dt.Rows[0]["picPath"].ToString();
      reklam1Url = dt.Rows[0]["AdvUrl"].ToString();
      if (dt.Rows.Count==2)
      {
          reklam2 = dt开发者_Python百科.Rows[1]["picPath"].ToString();
          reklam2Url = dt.Rows[1]["AdvUrl"].ToString();
      }
  }     

}


Check your stored procedure - is it possible that the result set coming from it changes contextually?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜