question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Linq to Access, only 25 times, must throw exception.

See original GitHub issue
public async Task<PageData<PlanEvaluation>> GetPlanEvaluationAsync()
{
    var connectionString = @"Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" + $"{path};PWD={password}";
    using context = new DataContext(ProviderName.AccessOdbc, connectionString);
    var table = context.GetTable<PlanEvaluation>();
    var total = await table.CountAsync();
    var items = await table.OrderByDescending(item => item.Id).Skip(0).Take(30).ToListAsync();
    return new PageData<PlanEvaluation>(total, items);
}
[Error] [Ibms.Collector.ControlExecutor] 数据库访问失败:"ERROR [08004] [Microsoft][ODBC Microsoft Access Driver] 客户端的工作过多。\r\nERROR [IM006] [Microsoft][ODBC 驱动程序管理器] 驱动程序的 SQLSetConnectAttr 失败"
System.Data.Odbc.OdbcException (0x80131937): ERROR [08004] [Microsoft][ODBC Microsoft Access Driver] 客户端的工作过多。
ERROR [IM006] [Microsoft][ODBC 驱动程序管理器] 驱动程序的 SQLSetConnectAttr 失败
   at System.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection connection, OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle)
   at System.Data.Odbc.OdbcConnectionOpen..ctor(OdbcConnection outerConnection, OdbcConnectionString connectionOptions)
   at System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.Odbc.OdbcConnection.Open()
   at System.Data.Common.DbConnection.OpenAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
   at LinqToDB.Data.DataConnection.EnsureConnectionAsync(CancellationToken cancellationToken)
   at LinqToDB.Data.DataConnection.QueryRunner.ExecuteReaderAsync(CancellationToken cancellationToken)
   at LinqToDB.Linq.QueryRunner.ExecuteQueryAsync[T](Query query, IDataContext dataContext, Mapper`1 mapper, Expression expression, Object[] ps, Object[] preambles, Int32 queryNumber, Func`2 func, TakeSkipDelegate skipAction, TakeSkipDelegate takeAction, CancellationToken cancellationToken)
   at LinqToDB.Linq.QueryRunner.ExecuteQueryAsync[T](Query query, IDataContext dataContext, Mapper`1 mapper, Expression expression, Object[] ps, Object[] preambles, Int32 queryNumber, Func`2 func, TakeSkipDelegate skipAction, TakeSkipDelegate takeAction, CancellationToken cancellationToken)
   at LinqToDB.Linq.ExpressionQuery`1.GetForEachAsync(Action`1 action, CancellationToken cancellationToken)
   at LinqToDB.AsyncExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken token)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:21 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
animittacommented, Jun 7, 2022

@viceroypenguin Many thanks! Everything is working fine now.

0reactions
animittacommented, Jun 8, 2022

@sdanyliv Ok, it’s working fine now. Let me close this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Throwing exceptions from Linq Query exception
One simple option is to change it to: // I don't think I'd use ?? like this, but that's not the point of...
Read more >
c# - Is it unreasonable to expect Any() *not* to throw a null ...
First off, it appears that that source code will throw ArgumentNullException , not NullReferenceException . Having said that, in many cases you ...
Read more >
Handle exceptions in query expressions (LINQ in C#)
The final example shows how to handle those cases when you must throw an exception during execution of a query.
Read more >
7 tricks to simplify your programs with LINQ - Igor Ostrovsky
The LINQ solution will grow the array dynamically, so garbage arrays will need to be collected by the runtime. That said, I use...
Read more >
InvalidOperationException Class (System)
An InvalidOperationException is thrown when you try to access a UI element from a thread other than the UI thread. The text of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found