TRY CATCH妙用
来源:互联网 发布:定时点击软件 编辑:程序博客网 时间:2024/05/16 11:11
今天跟了一天的程序,直到4点多,还没搞定一个BUG,很是郁闷,看了一会新闻,最后一刻,终于搞定了.问题是:checkResult = checkCOShiptoValidate(e, coNo, shiptoNo, thisShipto, out alertResult);代码总是报错,先是跟进去看,但是太复杂了,并且,每次重现这个错误都要好长时间,最后,发现,出错后,点击IE上的BACK按钮,就没错了,于是想出了这个方法:如果出错,就把页面刷新一下,
dg_shipmentList.CurrentPageIndex = 0;
bindGrid();
这二句是Page_Load里面的
if(!IsPostBack)
{
this.dg_shipmentList.CurrentPageIndex = 0;
bindGrid();
}
所以单独提出来.
try
{
checkResult = checkCOShiptoValidate(e, coNo, shiptoNo, thisShipto, out alertResult);
}
catch
{
Page_Load(null,null);
dg_shipmentList.CurrentPageIndex = 0;
bindGrid();
checkResult = checkCOShiptoValidate(e, coNo, shiptoNo, thisShipto, out alertResult);
}
{
checkResult = checkCOShiptoValidate(e, coNo, shiptoNo, thisShipto, out alertResult);
}
catch
{
Page_Load(null,null);
dg_shipmentList.CurrentPageIndex = 0;
bindGrid();
checkResult = checkCOShiptoValidate(e, coNo, shiptoNo, thisShipto, out alertResult);
}
- TRY CATCH妙用
- try....catch...finally 妙用
- erlang妙用try..catch写出优雅的代码
- try catch
- try{} catch{}
- try catch
- try...catch
- try{} catch(...){}
- try catch
- try-catch
- try catch
- try-catch
- try catch
- try catch
- try catch
- try catch
- try catch
- try {...} catch (){....}
- Role-based Security with Forms Authentication
- 5S 过程会议心得
- ASP.NET基于角色的窗体安全认证机制
- ASP.NET应用程序设计的10大技巧
- 自定义DataGrid分页
- TRY CATCH妙用
- DataList自定义分页
- Web.config中常用语句的使用方法和调用方法:
- 使用CSS
- 验证码
- Insert(注册页面)
- 地球化学图解系统GCDPlot0.33
- 修改用户信息(modify_user_info)
- 开幕词-默写-english