首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

服务器超时有关问题

2012-06-03 
服务器超时问题。在线等if (!this.IsPostBack){//字段排序操作int sumPageint pageNo 1int pageSize

服务器超时问题。在线等
if (!this.IsPostBack)
  {
   
  //字段排序操作

  int sumPage;
  int pageNo = 1;
  int pageSize = 10;
  if (Request.QueryString["CurrentPage"] == null)
  {
  pageNo = 1;
  }
  else
  {
  pageNo = Int32.Parse(Request.QueryString["CurrentPage"]);
  }
  string tablist = "a.id,a.jobname,a.jobcode,a.recruiter,a.manager,typeid,a.region,convert(varchar(20),a.intime,23) as intime,a.edittime,a.xmsession,a.department,(select count(b.xmid) as num1 from cvsession b,cvresume c where b.xmid = a.id and b.cvsession = '已申请' and c.id = b.cvid) as num1,(select count(b.xmid) as num1 from cvsession b,cvresume c where b.xmid = a.id and b.cvsession != '已申请' and c.id = b.cvid) as num2,(select count(b.xmid) as num1 from cvsession b,cvresume c where b.xmid = a.id and c.id = b.cvid) as num3,(select count(id) as num from colog where xmid=a.id) as lognum";
  string tabname = "xm a";
  string wh = "company = '" + Session["company"].ToString() + "'";
  string keywords = Server.UrlDecode(function.Filter(function.Vall("keywords")));
  if (keywords != null && keywords != "" && keywords != "请输入职位筛选关键字")
  {
  string[] key = keywords.Split(' ');
  for (int i = 0; i < key.Length; i++)
  {
  wh = wh + " and (CONTAINS(*, '" + key[i] + "' ) or jobcode like '%" + key[i] + "%')";
  }
  }
  string recruiters = Server.UrlDecode(function.Vall("recruiters"));
  if (recruiters != "")
  {
  wh = wh + " and a.recruiter like '%," + recruiters + ",%'";
  }
  string departments = Server.UrlDecode(function.Vall("departments"));
  if (departments != "")
  {
  wh = wh + " and a.department = '" + departments + "'";
  }
  string xmsessions = Server.UrlDecode(function.Vall("xmsessions"));
  if (xmsessions != "")
  {
  wh = wh + " and a.xmsession = '" + xmsessions + "'";
  }
  if (limit == "0")
  {
  string us = "";
  string mySql1 = "select username from colist where id = '" + Session["coid"].ToString() + "'";
  SqlCommand myCmd1 = new SqlCommand(mySql1, myConn);
  myCmd1.Connection.Open();
  SqlDataReader dr1 = myCmd1.ExecuteReader();
  if (dr1.Read())
  {
  us = "," + dr1["username"].ToString().Trim() + ",";
  }
  dr1.Close();
  myCmd1.Connection.Close();

  wh = wh + " and recruiter like '%" + us + "%'";
  }
  SqlDataAdapter da = new SqlDataAdapter();
  da.SelectCommand = new SqlCommand();
  da.SelectCommand.Connection = myConn;
  da.SelectCommand.CommandText = "getdataset";


  da.SelectCommand.CommandType = CommandType.StoredProcedure;
  da.SelectCommand.Parameters.Add("@TableList", SqlDbType.VarChar, 1000).Value = tablist;
  da.SelectCommand.Parameters.Add("@TableName", SqlDbType.VarChar, 30).Value = tabname;
  da.SelectCommand.Parameters.Add("@SelectWhere", SqlDbType.VarChar, 2000).Value = wh;
  da.SelectCommand.Parameters.Add("@SelectOrderId", SqlDbType.VarChar, 20).Value = "a.id";
  da.SelectCommand.Parameters.Add("@SelectOrder", SqlDbType.VarChar, 200).Value = selectorder;
  da.SelectCommand.Parameters.Add("@intPageNo", SqlDbType.Int).Value = pageNo;
  da.SelectCommand.Parameters.Add("@intPageSize", SqlDbType.Int).Value = pageSize;
  da.SelectCommand.Parameters.Add("@RecordCount", SqlDbType.Int).Direction = ParameterDirection.Output;
  da.SelectCommand.Parameters.Add("RowCount", SqlDbType.Int).Direction = ParameterDirection.ReturnValue;
  DataSet ds = new DataSet();
  da.Fill(ds, "profile");//这里报超时
  Int32 RecordCount = (Int32)da.SelectCommand.Parameters["@RecordCount"].Value; //求出总记录数,该值是output出来的值
  Int32 RowCount = (Int32)da.SelectCommand.Parameters["RowCount"].Value; //求出当前页中的记录数,在最后一页不等于pagesize
  if (RecordCount > 0)
  {
  GridView1.DataSource = ds;
  GridView1.DataBind();
  }
  else
  {
  RecordCount = 0;
  }
  myConn.Close();
  Paging.RecordCount = RecordCount;
  Paging.pageSize = pageSize;
  Paging.pageNo = pageNo;

[解决办法]
myConn open 了吗
[解决办法]
你的存储过程...........
是不是数据量太大了
[解决办法]
应该你的存储过程或者传入的参数有问题。这个需要你自己去进行测试,把传入的参数放到查询分析器里面进行测试
[解决办法]
与数据库操作超时一般有两种情况:一种是连接超时,一种是执行命令超时。你这可能是执行命令超时,也许是数据量大的原因,设置一下Command.CommandTimeout的值,默认为30秒

热点排行