I was developing an application in which I launch queries automatically, consecutively, always the same.
The problem comes when the DB is slow to respond, in some way, without knowing why, perhaps due to the traffic or the amount of information, the query takes longer than it should, causing the TimeOut Error
The message that comes to me is
MySql.Data.MySqlClient.MySqlException: 'Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. '
I keep the queries in a List<String>
to not throw them all at once using Union and not overload the DB.
for(int i = 0; i<consultas.Count;i++){
consulta.CommandText = querys[i];
dr = consulta.ExecuteReader();
}
Treating the exception does not solve the problem, since data can not be missing .
Is there a way to avoid TimeOut?