erkan demir
erkan demir

Reputation: 1416

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.Rows[1]["picPath"].ToString();
          reklam2Url = dt.Rows[1]["AdvUrl"].ToString();
      }
  }     

}

Upvotes: 1

Views: 4171

Answers (1)

The Evil Greebo
The Evil Greebo

Reputation: 7138

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

Upvotes: 3

Related Questions