网站用的是ACCESS数据库,首页的新闻控件在第一次加载后(显示5条新闻),之后我在库里再新加一条新闻,刷新前台页面,控件无法显示刚才加的那条新闻,即使我导航到其它页面,再点首页,还是无法加载.新闻用户控件我没有用缓存机制.尝试清除IE的临时文件,关闭再打开,还是一样无法更新.

解决方案 »

  1.   


    private void Page_Load(object sender, System.EventArgs e)
    {
    IntoNewsFunctionOne();
    }我的代码如下public void IntoNewsFunction()
    {
    OleDbConnection newConn=CommonClass.GetAccessConnString();
    OleDbDataAdapter sda=new OleDbDataAdapter("select top 8 newsid,newsclass,newstitle,newstitle as newstip,newssubtitle,newscreater,newscontent,newscreatetime,lookcount from NewsInfor Where NewsClass='公司新闻' Order By NewsCreateTime Desc",newConn);
    sda.SelectCommand.CommandType = CommandType.Text;
    DataSet ds=new DataSet();
    sda.Fill(ds);
    this.dgdNewsList.DataSource=ds;
    this.dgdNewsList.DataBind(); }