SQL Error The turnaround time has expired

0

I have a sqlServer problem in my .net MVC application

Well the error is thrown from the da.fill(ds) line :

cmd = new SqlCommand(req, con);
        DataSet ds = new DataSet();
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        da.Fill(ds);
        return ds;

and this is the error :

 The turnaround time has expired. The timeout elapsed before the end of the operation or the server does not respond. '
 System.Data.SqlClient.SqlException
  HResult = 0x80131904
 Message = The execution time has expired. The timeout elapsed before the end of the operation or the server does not respond.
 Source = .Net SqlClient Data Provider
  Procedure tree:
 <Can not Evaluate Exception Procedure Call Tree>

Well i found the main problem and it is an sql request :

 SELECT  * 
    from Nbre_enq_livreur   
 where (nb_enq >= 3) and T_PHONET = 207 and t_groupement = 25  
   GROUP BY T_PHONET,livreur,Init_Maglivreur,nb_enq,t_groupement
   Well it is correct but t_groupement and t_phonet don't want to work togther 

I waited for 15 min and still circuling wwhen launching the request in MSMS

Any help and ty

sql-server
asp.net-mvc
asked on Stack Overflow Nov 29, 2019 by zarzou • edited Dec 2, 2019 by zarzou

1 Answer

0

If your query needs more than the default 30 seconds, you might want to set the CommandTimeout higher. To do that you'll change it after you instantiated the DataAdapter on the SelectCommand property of that instance, like so:

//set the CommandTimeout
da.SelectCommand.CommandTimeout = 60;  // seconds

Code will be

cmd = new SqlCommand(req, con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.SelectCommand.CommandTimeout = 60;  // seconds
da.Fill(ds);
return ds;
answered on Stack Overflow Nov 29, 2019 by Vignesh Kumar A

User contributions licensed under CC BY-SA 3.0