Jonas Arcangel
Jonas Arcangel

Reputation: 1925

extending query timeout settings

I have a WPF application that directly communicates with a MS SQL 2008 database.

In the connection string, I have explicitly set the connection time out to be "Connect Timeout=6000", which should give me ten minutes.

I see that my application gives me a timeout error in just a little more than a minute. How can I ensure that I am given 10 minutes to complete my query?

I don't know if there's something missing in my connection string setup or database call, or whether this should be configured from the MS SQL server.

Upvotes: 1

Views: 1756

Answers (3)

Harvey Kwok
Harvey Kwok

Reputation: 11873

There is a different timeout value for query. If you are using SqlCommand, you can set your timeout value using SqlCommand.CommandTimeout

Upvotes: 1

Babak Naffas
Babak Naffas

Reputation: 12561

Setting 'Connect Timeout' in your connection string only applies to the opening of your connection to the database. In your query method, you need to set the timeout on your DbCommand object to your connection's timeout.

Upvotes: 0

Jonas Arcangel
Jonas Arcangel

Reputation: 1925

I just checked similar questions here and there's something written about a CommandTimeout. Let me try that first. Thanks!

Upvotes: 1

Related Questions