“/”应用程序中的服务器错误。

ExecuteNonQuery 要求已打开且可用的 Connection。连接的当前状态为已关闭。

说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.InvalidOperationException: ExecuteNonQuery 要求已打开且可用的 Connection。连接的当前状态为已关闭。

源错误:


行 45:     {
行 46:         SqlCommand cmd = new SqlCommand(m.strsql(sql), conn);
行 47:         int val = cmd.ExecuteNonQuery();
行 48:         return val;
行 49:     }

源文件: d:\web\官网\cogitosoft.com\cogitosoft.com\cogitosoft.com\www\App_Code\db.cs    行: 47

堆栈跟踪:


[InvalidOperationException: ExecuteNonQuery 要求已打开且可用的 Connection。连接的当前状态为已关闭。]
   System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async) +2523272
   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) +110
   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +198
   db.q(String sql) in d:\web\官网\cogitosoft.com\cogitosoft.com\cogitosoft.com\www\App_Code\db.cs:47
   html_article_item.Page_Load(Object sender, EventArgs e) in d:\web\官网\cogitosoft.com\cogitosoft.com\cogitosoft.com\www\html\product\item.aspx.cs:28
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +95
   System.Web.UI.Control.LoadRecursive() +59
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678


版本信息: Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.7.3930.0