本地调试的.在登录后显示首页的地方超时.错误信息是:
超时时间已到。在操作完成之前超时时间已过或服务器未响应。并不是每次都超时,大概30%的样子
整个网站仅有这个地方会出现超时
生成首页时调用存储过程,获取一个dataset,里面大概有4张表,每个表有5条数据.
超时时间设置的是30S怎么解决?是程序问题还是中毒了?

解决方案 »

  1.   

    在你的链接字符串 后加 pooling=false; 如下 意思就是 不限制 链接时间
    <add name="constr" connectionString="database=tem;server=.;uid=sa;pwd=123456;pooling=false;"/>
      

  2.   

    调用部分的代码static public DataSet getdefinfo(string id, string compid)
            {
                string strcon = System.Configuration.ConfigurationManager.AppSettings["conn"];
                SqlConnection conn = new SqlConnection(strcon);
                SqlCommand comm = new SqlCommand("getdefinfo", conn);
                comm.CommandType = CommandType.StoredProcedure;
                if (compid != "")
                {
                    SqlParameter p2 = new SqlParameter("@compid", SqlDbType.NVarChar, 50);
                    p2.Direction = ParameterDirection.Input;
                    p2.Value = compid;
                    comm.Parameters.Add(p2);            }
                if (id != "")
                {
                    SqlParameter p2 = new SqlParameter("@id", SqlDbType.NVarChar, 50);
                    p2.Direction = ParameterDirection.Input;
                    p2.Value = id;
                    comm.Parameters.Add(p2);            }
                conn.Open();
                DataSet ds = new DataSet();
                SqlDataAdapter da = new SqlDataAdapter(comm);
                da.Fill(ds);
                conn.Close();
                return ds;
            }
    存储过程set ANSI_NULLS ON
    set QUOTED_IDENTIFIER ON
    goALTER proc [dbo].[getdefinfo]
    (
    --获取首页的信息
    @compid char(11),
    @id char(11)
    )
    as
    begin
    --1.获取合同,回款的月度信息
    declare @tb1 table([type] nvarchar(10),[sum] int  default 0)
            declare @sum1 int --合同额
            select @sum1 = sum(pact_sum) from pact  where pact_netuid = @id and year(pact_time) = year(getdate()) and month(pact_time) = month(getdate())
             if(@sum1 is null)
    set @sum1 = 0
    insert into @tb1([type],[sum]) values('合同总额',@sum1)
    ------------------------------------------------------------------------------------------
    declare @sum2 int --预计回款额
    select @sum2 = sum(back_money) from pact inner join backmoney on back_pactID = pact_id where pact_netuid = @id and year(pact_time) = year(getdate()) and month(pact_time) = month(getdate())
     if(@sum2 is null)
    set @sum2 = 0
    insert into @tb1([type],[sum]) values('预计回款额',@sum2)
    -------------------------------------------------------------------------------------------
        declare @sum3 int --已回款额
    select @sum3 = sum(pact_backsum) from pact where pact_netuid = @id and year(pact_time) = year(getdate()) and month(pact_time) = month(getdate())
            if(@sum3 is null)
    set @sum3 = 0
    insert into @tb1([type],[sum]) values('已回款金额',@sum3)         select * from @tb1
    ------------------------------------------------------
    -------------2. 热点客户
    select top 10 cust_name,cust_id,cust_hot from custom where cust_netuid = @id and cust_hot is not null and cust_hot != '0' and cust_hot !='' order by cust_utime desc

    --------------------------------------------------------
    --------------3.公告信息select top 10 gong_id,gong_title from gonggao where gong_compid = @compid and DATEDIFF(day,getdate(),gong_totime)>0 order by gong_lv desc,gong_ctime desc--------4 代办任务信息
    --代办状态 为 执行中 以及 已超期
    select cust_name,task_id,task_title,[date] = cast(year(task_ftime) as nvarchar)+'-'+cast(month(task_ftime) as nvarchar)+'-'+cast(day(task_ftime) as nvarchar) ,taskstatelist_name from task left join custom on cust_id = task_custid  left join taskstatelist on taskstatelist_id = task_stateID where (taskstatelist_name = '超期' or taskstatelist_name = '执行中') and task_execID = @id  order by taskstatelist_name,task_prior
    end
    仅仅在首页load事件加载到gridview里,没有循环
      

  3.   

    感觉像是出现锁等待,甚至死锁,毕竟你有Insert这种更新数据库的操作
    你研究研究并发的情况会不会出现异常吧
      

  4.   

    检查你的程序,是否有事务没有释放的,或者sql太负责,执行速度太慢,
      

  5.   

    另外 刚才有试了,在超时的情况下 使用sqlserver执行 也执行不出来. 平常状态下 响应时间不超过1S