tags:

views:

38

answers:

1

Hi,

I'm trying to execute a select using C#. The problem is that, despite the fact that I modified the timeout period, it thrown a timeout exception. It is rising the exception after 30 seconds, that is the default value.

using (MySqlConnection conn = new MySqlConnection(connStr))
{
   int x = conn.ConnectionTimeout;

   conn.Open();
   cmd.Connection = conn;

   cmd.CommandText = "SELECT AVG(v.value_min) AS minValue FROM values v";

   adpter.SelectCommand = cmd;
   adpter.Fill(dados);

   conn.Close();
}

As you can see, I'm using conn.ConnectionTimeout to check if the timeout is properly configured and, yes it is. At least it shows the amount of time that I configured (in that case 90).

So, how do I do this? How to run a long time query?

TIA,

Bob

UPDATE: The query that I posted is just an example.

+2  A: 

Setting the CommandTimeout property on your MySqlCommand instead of the connection should do the trick.

nos
Opps... Thanks. I dind't saw the property,,,
Bob Rivers