conn.open();
建立一个SqlCommand sqlcmd=new SqlCommand();
sqlcmd.CommandTimeout=180;
意思为sqlcmd的超时为3分钟。
可根据需要设置,如果过长,也可以设置为0,当此属性设置为0时表示不限制时间。此属性值应该慎用。还需要在Web.config配置文件中设置http请求运行时限间
<system.web>
<httpRuntime maxRequestLength="102400" executionTimeout="720" />
</system.web>
这里设置的为720秒,前面的属性maxRequestLength一般用于用户上传文件限制大小!默认一般为4096 KB (4 MB)。
建立一个SqlCommand sqlcmd=new SqlCommand();
sqlcmd.CommandTimeout=180;
意思为sqlcmd的超时为3分钟。
可根据需要设置,如果过长,也可以设置为0,当此属性设置为0时表示不限制时间。此属性值应该慎用。还需要在Web.config配置文件中设置http请求运行时限间
<system.web>
<httpRuntime maxRequestLength="102400" executionTimeout="720" />
</system.web>
这里设置的为720秒,前面的属性maxRequestLength一般用于用户上传文件限制大小!默认一般为4096 KB (4 MB)。