22,209
社区成员
发帖
与我相关
我的任务
分享
SqlCommand selectCommand = new SqlCommand(queryText, this.openConnection());
//得到Web.config里DB_ConnectionString中Connection Timeout=90
selectCommand.CommandTimeout = cn.ConnectionTimeout;
或者
SqlCommand selectCommand = new SqlCommand(queryText, this.openConnection());
selectCommand.CommandTimeOut=0;
<connectionStrings>
<add name="DB_ConnectionString" connectionString="Data Source=xxx.xxx.xxx.xxx;Initial Catalog=DB NAME;Persist Security Info=false;User ID=sa;Password=sa;Connection Timeout=90;" providerName="System.Data.SqlClient"/>
</connectionStrings>