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

序列不包含任何元素

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

异常详细信息: System.InvalidOperationException: 序列不包含任何元素

源错误:


行 6:              Dim id As Integer = CInt(Request.QueryString("ID"))
行 7:              Dim db As New WaterDBDataContext
行 8:              Dim news As NewsDetailTable = (From c In db.NewsDetailTable Where c.typeID = 1 And c.language = 0 And c.condition = 1 And c.ID = id Select c).First
行 9:              titleDIV.InnerText = news.title
行 10:             contentDIV.InnerHtml = Server.HtmlDecode(news.detailContent)

源文件: D:\web\en\html\newsDetails.aspx.vb    行: 8

堆栈跟踪:


[InvalidOperationException: 序列不包含任何元素]
   System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult) +847
   System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries) +113
   System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) +344
   System.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute(Expression expression) +49
   System.Linq.Queryable.First(IQueryable`1 source) +269
   en_html_newsDetails.Page_Load(Object sender, EventArgs e) in D:\web\en\html\newsDetails.aspx.vb:8
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627


版本信息: Microsoft .NET Framework 版本:2.0.50727.8964; ASP.NET 版本:2.0.50727.8962