这是我加载一个页面的代码
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(!IsPostBack)BindGrid();
}
public void BindGrid()
{

//连接数据库
string strconn = ConfigurationSettings.AppSettings["dns"];
SqlConnection cn = new SqlConnection(strconn);
//创建SQL对象,调用视图
SqlDataAdapter da = new SqlDataAdapter("zhigonglist",cn);
//创建并填充DataSet
DataSet ds = new DataSet();
da.Fill(ds);
zhigonglist.DataSource = ds.Tables[0].DefaultView;
zhigonglist.DataBind();
cn.Close();


}
不知道怎么会事,登陆到这个页面时出现一个aspnet_awp.exe进程,使CPU达到100%,这个页面也无法打开。然后电脑运行很慢。原来不会出现这种情况,请问这是怎么会事,有解决的办法没?

解决方案 »

  1.   

    运行asp.net他就会有aspnet_awp.exe进程
    达到100%
    可能是你的存储过程“zhigonglist”有什么问题,不知道写了什么
      

  2.   

    zhigonglist就是select * from zhigong,这样写不行吗,我另一个页面也调用这个过程没事啊!?
      

  3.   

    以前我的也出現過這個問題,但是我到Microsoft的網站把我的系統打了一下補丁就可以了。
      

  4.   


    SqlDataAdapter da = new SqlDataAdapter("zhigonglist",cn);应该是这得问题:
    还有:da.Fill(ds);---改成:da.Fill(ds,"zhigonglist");
      

  5.   

    //****你把视图放在存储过程里面试一下
    Create porc proc_system_filter
    (
        @SQLEx varchar(1000)     
    )
    as
    begin
          
          declare @strSQL varchar(2000);
          
          set @strSQL='SELECT * FROM VIEW_SYSTEM_FILTER WHERE(1>0)'      if(@SQLEx is not null and rtrim(ltrim(@SQLEx))<>'' and @SQLEx<>'')
          begin
             @strSQL=@strSQL+@SQLEx;
          end
          
          exec(@strSQL);
    end
    //*****数据调用
    private void LoadDataBind()
    {
       SqlCommand sqlcom=new sqlcommand("proc_system_filter",sqlcon);
       sqlcom.comandtype=commandtype.sorteproducted;   sqlcom.paramter.add(new sqlparamter("@SQLEx",sqldbtype.varchar,100));
       sqlcom.paramter["@SQLEx"].value=txtsql.text;
       --拆行命令
       sqldataapter sqlapter=sqlcom.executereader();
       DGRid.datasource=sqlapter;
       DGRid.databind();}
      

  6.   

    不会吧。我前几天运行还正常!
    hunter_32,要打什么样的补丁!
      

  7.   

    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;
    using System.Data.Common;
    using System.Data.SqlClient;
    using System.Configuration;namespace news.page
    {
    /// <summary>
    /// gengxin 的摘要说明。
    /// </summary>
    public class gengxin : System.Web.UI.Page
    {
    protected System.Web.UI.HtmlControls.HtmlForm Form1;
    protected System.Web.UI.WebControls.Button Button1;
    protected System.Web.UI.WebControls.DataGrid zhigonglist;

    private void Page_Load(object sender, System.EventArgs e)
    {
    // 在此处放置用户代码以初始化页面
    if(!IsPostBack)BindGrid();
    }
    public void BindGrid()
    {

    //连接数据库
    string strconn = ConfigurationSettings.AppSettings["dns"];
    SqlConnection cn = new SqlConnection(strconn);
    //创建SQL对象,调用视图
    SqlDataAdapter da = new SqlDataAdapter("zhigonglist1",cn);
    //创建并填充DataSet
    DataSet ds = new DataSet();
    da.Fill(ds,"zhigonglist1");
    zhigonglist.DataSource = ds.Tables[0].DefaultView;
    zhigonglist.DataBind();
    cn.Close();


    }
    private void zhigonglist_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
    {
    this.zhigonglist.CurrentPageIndex = e.NewPageIndex;
    BindGrid();
    } private void Button1_Click(object sender, System.EventArgs e)
    {
    Response.Redirect("add.aspx");
    } private void zhigonglist_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
    {
    //从文件WEB。CONFIG中读连接字符串
    string strconn = ConfigurationSettings.AppSettings["dns"];
    //连接数据库TSGL
    SqlConnection cn = new SqlConnection(strconn);
    cn.Open();
    string zhigongdelete = "delete from zhigong where id=@id";
    SqlCommand cm = new SqlCommand(zhigongdelete,cn);
    cm.Parameters.Add("@id",SqlDbType.Int);
    //从DATEGRID中取得更新内容,Cell[1]为UID列
    string bidvalue = e.Item.Cells[0].Text.ToString();
    cm.Parameters["@id"].Value = bidvalue;
    try
    {
    cm.ExecuteNonQuery();
    }
    catch(Exception fa)
    {
    Response.Write(fa.Message.ToString());
    }
    zhigonglist.EditItemIndex = -1;
    BindGrid();
    Response.Write("<script language='javascript'>alert('删除成功');</script>");
    } private void zhigonglist_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
    {

    if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) 

    //删除确认            
    LinkButton delBttn = (LinkButton) e.Item.Cells[10].Controls[0]; 
    HyperLink nameHlk = (HyperLink) e.Item.Cells[2].Controls[1];
    delBttn.Attributes.Add("onclick","javascript:return confirm('确定删除" + nameHlk.Text + "?');"); 
    //颜色交替   
    e.Item.Attributes.Add("onmouseover","this.style.backgroundColor='seashell'"); 
    if(e.Item.ItemType == ListItemType.Item) 

    e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='#ffffff'"); 
    }  if(e.Item.ItemType ==ListItemType.AlternatingItem) 

    e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='seashell'"); 

    }
    this.zhigonglist.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.zhigonglist_ItemDataBound);
    }
    }
    }
    }
    我把后台贴出来了,大家帮我看看是不是死循环?请各位高手帮帮忙啊!!!
      

  8.   

    如果是运行到if(!IsPostBack)BindGrid(); CPU就达到100%,看看zhigong表的数据有多少,如果超过几万甚至几十万条数据的话,那就应该是DataSet不堪重负了。尝试优化查询,或者每次取页面所需要的数据量
      

  9.   

    我的数据量才二十来条,怎么会这样呢?我尝试删到数据才8条又可以了,这是为什么呢?DataSet的承载量就这么大?请问有什么办法解决吗?
      

  10.   

    你设置一下断点,测试一下是在哪里开始出现CPU 占用率为100%的!