crazy novice
crazy novice

Reputation: 1817

Use of backgroundworker is good when your thread may have to wait for long time

My winform application requires to query database (via stored procedures) frequently to retrieve any new updates. This is currently done through background worker thread. The problem is that sometimes stored procedures takes a long time which means (per my understanding ) that we are wasting threadpool thread resource as all its doing is just waiting for db call to complete. I was just wondering if there are any better ways of handling this (something like APM begin/end type of calls)?

Upvotes: 0

Views: 97

Answers (1)

Guffa
Guffa

Reputation: 700362

You can use the BeginExecuteReader method to make an asynchronous datebase call.

Upvotes: 1

Related Questions