Sql Timeout with WebMatrix.Data.Database

1

Using the WebMatrix.Data.Database namespace, I'm having trouble executing a query that returns a lot of data, resulting in a Timeout.

How can I increase the timeout of this query?

Code sample:

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 only change the timeout of the connection time, but I can not find the property to change the query timeout.

    
asked by anonymous 20.06.2014 / 19:50

1 answer

1

You've tried something like

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

Or change the sql Server default using sp_configure

See this question: link

    
30.07.2014 / 02:16