sqlserver超时时间已到



public DataTable GetProDataTable(string produceName, SqlParameter[] para) { DataTable dt = new DataTable(); SqlCommand command = new SqlCommand(produceName, this.sqlconn); if (this.sqlTran != null) { command.Transaction = this.sqlTran; } if (this.CommandTimeout != -1) { command.CommandTimeout = this.CommandTimeout; } command.CommandType = CommandType.StoredProcedure; command.Parameters.AddRange(para); try { /* 这部分代码会占满连接池,产生异常 if (this.sqlconn.State == ConnectionState.Closed) { this.sqlconn.Open(); } */ SqlDataAdapter adapter = new SqlDataAdapter(command); adapter.Fill(dt); } catch (SqlException ex) { //OriginalLog.Error(ex.ToString()); throw (ex); } return dt; }

 

posted @ 2017-08-23 09:31  Coder_小菜  阅读(1388)  评论(0编辑  收藏  举报