after filling dataset then also it shows old values in dataset.
This problem arises sometimes but after uploading web.config it shows proper data in dataset.
Site working fine on old iis but when we shifted it to iis 7 this problem started.
please answer me as soon as possible thanks in advance
not just on one page on every page it gives error because it is giving some weird data and not taking data from given sql.
code:
SqlConnection con1 = new SqlConnection("connction" );
DataSet temp = new DataSet();
SqlCommand temp1 = new SqlCommand();
SqlDataAdapter temp2;
ds = new DataSet();
int bcnt = 0, rcnt = 0;
ds = null;
ds = new DataSet(); string col = string.Empty;
temp1 = new SqlCommand("select image, linkto, desiredwidth from ( select image, linkto, desiredwidth from pbdetail, userbanner where pbdetail.userbannerid=userbanner.userbannerid and pagebannerid=1 and disp=1 and (pbdetail.awaiting =0 or pbdetail.awaiting is null) union select image, linkto, desiredwidth from pbdetail where pbdetail.userbannerid=0 and pagebannerid=1 and disp=1 and (pbdetail.awaiting =0 or pbdetail.awaiting is null) )q1 order by newid() ", con1);
temp2 = new SqlDataAdapter(temp1);
temp2.Fill(temp);
if (temp.Tables[0].Rows.Count > 0)
{
for (int i = 0; i <= rcnt; i++)
{
string x = "banner" + i.ToString();
Image banner = (Image)FindControl(x);
string str = ds.Tables[0].Rows[i]["image"].ToString();
if (str.StartsWith("u") == true)
{
banner.ImageUrl = ds.Tables[0].Rows[i]["image"].ToString();
}
else
{
banner.ImageUrl = "uploads/" + ds.Tables[0].Rows[i]["image"].ToString();
}
HtmlAnchor linkto = (HtmlAnchor)FindControl("linkto" + i.ToString());
linkto.HRef = "http://" + ds.Tables[0].Rows[i]["linkto"].ToString() + "";
}
}
[edit]Code block added - OriginalGriff[/edit]