首页 新闻 会员 周边 捐助

EF查询数据库出现异常

0
[已关闭问题] 关闭于 2021-04-14 02:06

我有很简单的一段EF 查询代码:

var query = db.Etrans.Where(s => s.transactionId != null && s.crdate > checktime && s.transactionStatus == null).ToList();

但是有时会报错:

The underlying provider failed on Open.:
at System.Data.Entity.Core.EntityClient.EntityConnection.Open()
at System.Data.Entity.Core.Objects.ObjectContext.EnsureConnection(Boolean shouldMonitorTransactions)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess) at System.Data.Entity.Core.Objects.ObjectQuery1.<>c__DisplayClass41_0.<GetResults>b__0()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func1 operation) at System.Data.Entity.Core.Objects.ObjectQuery1.GetResults(Nullable1 forMergeOption) at System.Data.Entity.Core.Objects.ObjectQuery1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__31_0()
at System.Data.Entity.Internal.LazyEnumerator1.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
at OneInc.OneIncService.UpdatePaymentStatus() in C:\Users\dhong\Documents\Projects\C#\VerifyOnlinePayments\VerifyOnlinePayments\OneIncService.cs:line 132
at OneInc.OneIncService.CheckDataByTransactionId(Boolean neednotifyCFP) in C:\Users\dhong\Documents\Projects\C#\VerifyOnlinePayments\VerifyOnlinePayments\OneIncService.cs:line 49
at TestOneIncAPI.Program.Main(String[] args) in C:\Users\dhong\Documents\Projects\C#\VerifyOnlinePayments\VerifyOnlinePayments\Program.cs:line 14

我不太会分析 StackTrace,所以请教这是什么原因造成的异常?

泰德的主页 泰德 | 初学一级 | 园豆:6
提问于:2021-04-08 11:02
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册