string year_para=this.year.SelectedItem.Text.ToString();
this.myconn=new OdbcConnection("DSN=aa;uid=bb;pwd=cc");
myconn.ConnectionTimeout=600000;
string str="exec ZG_YSFDetailAccount  '"+year_para+"'";
OdbcCommand oc=new OdbcCommand(str,myconn);
oc.CommandTimeout=0;
OdbcDataAdapter  oda=new OdbcDataAdapter(oc);
DataSet ds=new DataSet();
myconn.Open();
oda.Fill(ds,"Temp");
myconn.Close();
this.DataGrid1.DataSource=ds.Tables["Temp"];
this.DataGrid1.DataBind();
 为什么当year_para=1的时候DataGrid1能显示值
当year_para>1的时候报错“未将对象引用设置到对象的实例”
该如何解决??
  我猜想是存储过程执行时间长造成的,在后台看了执行时间
当year_para=1时为15秒,当year_para=2时为31秒,当year_para越大,执行时间越长,
想不通的是,我已经把CommandTimeout设为0,ConnectionTimeout也很大了,怎么还不行
  请各位高手指点!!

解决方案 »

  1.   

    这么长得时间,页面有效期是否会过期。
    另外,这么长的时间,没有实用性的吧?难道你让用户等2个小时!?
      

  2.   

    这个程序,用户有许多实时计算要求,且同时访问10几个数据库,和他们沟通过,他们宁肯牺牲时间也要保证实时性,所以这个可以不考虑,而且也不可能想你说的那样,关键是该怎么解决,请求帮助!