Timeout expired
-
I am working on .Net 2.0 and SQL 2000. While running my application, during dataset fill I get the following error "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding" I tried setting connection timeout to 0 and command timeout to 0. This is the code: public DataSet FillDatasetSQL(string strQuery) { try { //-----Connection open sqlConn = new SqlConnection(strSqlConn); sqlConn.Open(); //-----Fill Dataset DataSet ds = new DataSet(); sqlAdap = new SqlDataAdapter(strQuery, sqlConn); sqlAdap.Fill(ds, "Tablename"); <=========== error occurs here //-----Connection close sqlConn.Close(); sqlConn.Dispose(); return ds; } catch(Exception ex) { if (sqlConn.State == ConnectionState.Open) sqlConn.Close(); sqlConn.Dispose(); throw ex; } } Please help Senthil
-
I am working on .Net 2.0 and SQL 2000. While running my application, during dataset fill I get the following error "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding" I tried setting connection timeout to 0 and command timeout to 0. This is the code: public DataSet FillDatasetSQL(string strQuery) { try { //-----Connection open sqlConn = new SqlConnection(strSqlConn); sqlConn.Open(); //-----Fill Dataset DataSet ds = new DataSet(); sqlAdap = new SqlDataAdapter(strQuery, sqlConn); sqlAdap.Fill(ds, "Tablename"); <=========== error occurs here //-----Connection close sqlConn.Close(); sqlConn.Dispose(); return ds; } catch(Exception ex) { if (sqlConn.State == ConnectionState.Open) sqlConn.Close(); sqlConn.Dispose(); throw ex; } } Please help Senthil
How and where did you try set the command timeout? Did you try set it in the connection string or did you do something like:
sqlAdap = new SqlDataAdapter(strQuery, sqlConn); **sqlAdap.SelectCommand.CommandTimeout = 120;** sqlAdap.Fill(ds, "Tablename");
Dad always thought laughter was the best medicine, which I guess is why several of us died of tuberculosis. I can picture in my mind a world without war, a world without hate. And I can picture us attacking that world, because they'd never expect it.
-
I am working on .Net 2.0 and SQL 2000. While running my application, during dataset fill I get the following error "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding" I tried setting connection timeout to 0 and command timeout to 0. This is the code: public DataSet FillDatasetSQL(string strQuery) { try { //-----Connection open sqlConn = new SqlConnection(strSqlConn); sqlConn.Open(); //-----Fill Dataset DataSet ds = new DataSet(); sqlAdap = new SqlDataAdapter(strQuery, sqlConn); sqlAdap.Fill(ds, "Tablename"); <=========== error occurs here //-----Connection close sqlConn.Close(); sqlConn.Dispose(); return ds; } catch(Exception ex) { if (sqlConn.State == ConnectionState.Open) sqlConn.Close(); sqlConn.Dispose(); throw ex; } } Please help Senthil
-
I think no need to set connection timeout=0 and Cammand timeout=0.. plz check the connection string and type the following code in web.config not sure..try this...
Rajendran
-
How and where did you try set the command timeout? Did you try set it in the connection string or did you do something like:
sqlAdap = new SqlDataAdapter(strQuery, sqlConn); **sqlAdap.SelectCommand.CommandTimeout = 120;** sqlAdap.Fill(ds, "Tablename");
Dad always thought laughter was the best medicine, which I guess is why several of us died of tuberculosis. I can picture in my mind a world without war, a world without hate. And I can picture us attacking that world, because they'd never expect it.
Thanks for your reply. You are right. I too tried the same what u said. But it doesn't work out well. Senthil
-
Thanks for your reply. I had tried this already. but no use. One more information I am using 2 connections 1 for Insert / Update / Delete with transaction 1 for Select without transaction I suspect whether it is a deadlock Senthil
-
Thanks for your reply. You are right. I too tried the same what u said. But it doesn't work out well. Senthil
How much data are you trying to bring back? It might be that the sql statement is running fine but it's timing out trying to fill the dataset. If you run the SQL statement in Query Analyser or Management Studio, how many rows do you get back and how big (data wise) are the rows?
Dad always thought laughter was the best medicine, which I guess is why several of us died of tuberculosis. I can picture in my mind a world without war, a world without hate. And I can picture us attacking that world, because they'd never expect it.
-
I am working on .Net 2.0 and SQL 2000. While running my application, during dataset fill I get the following error "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding" I tried setting connection timeout to 0 and command timeout to 0. This is the code: public DataSet FillDatasetSQL(string strQuery) { try { //-----Connection open sqlConn = new SqlConnection(strSqlConn); sqlConn.Open(); //-----Fill Dataset DataSet ds = new DataSet(); sqlAdap = new SqlDataAdapter(strQuery, sqlConn); sqlAdap.Fill(ds, "Tablename"); <=========== error occurs here //-----Connection close sqlConn.Close(); sqlConn.Dispose(); return ds; } catch(Exception ex) { if (sqlConn.State == ConnectionState.Open) sqlConn.Close(); sqlConn.Dispose(); throw ex; } } Please help Senthil
I just want to double check with you that you have done everything you need to do. So here is an example from my own code that works:
oconn.ConnectionTimeout = 0 oconn.CommandTimeout = 0 oconn.Open "Driver={SQL Server};Server=Hal2000;Database=Europa;Uid=sa; Pwd= :P ;timeout=0;"
One final thing do you need to set up an ODBC connection on the computer, and if you do have you set this up?
You always pass failure on the way to success.