Sql Timeout with Webmatrix.Data.Database

Asked

Viewed 164 times

1

Using the Webmatrix.Data.Database namespace, I am having problems executing a query that returns a lot of data, resulting in a Timeout.

How can I increase the timeout of this query?

Code example:

var db = WebMatrix.Data.Database.Open("DefaultConnection");

var resultado = db.Query(consulta); //Timeout na execução desta consulta

return resultado.ToList().Count;

Web.config

<add name="DefaultConnection" connectionString="Data
Source=localhost;Initial Catalog=DefaultDB;User Id=foo;Password=bar;"
providerName="System.Data.SqlClient" />

I can change the timeout of the connection time only, but I can’t find the property to change the timeout of the performed query.

1 answer

1

Have you ever tried something like

"Data Source=localhost;Initial Catalog=database;Connect Timeout=15"

Or change the sql Server default using sp_configure

Look at this question: https://stackoverflow.com/a/3091919

Browser other questions tagged

You are not signed in. Login or sign up in order to post.