When I try to execute a query and after 30 seconds the program sends me error :
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Exception Detail: System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Source error:
Line 550 Dim myDataSet as Dataset = New DataSet
Line 551 myDataSet = db.ExecuteDataSet(System.Data.CommanType.Text,NewSql) <== Error line
Line 552 i=myDataSet.Tables(0).Rows.Count
In my connection string I set the parameter "Connection Timeout" = 360 but it not works. ( In debug mode the value for db.GetConnection.ConnectionTimeout is the same(360) like the parameter timeout connection.
After many searchs I found the default value for CommandTimeout is 30 secs. Can I change this value ?
Any suggestion will be welcome.
I'm using FrameWork 1.1.
create a SqlCommand object and set the CommandTimeout on that.
Hope it helps
|||Klaus,
Do you have an example or reference in order to get the code?
Thanks in advance,
Juan Carlos
|||Ok. I found the example and the solution for my case is :
Dim myDataSet as Dataset = New DataSet
Dim cmd as DbCommandWrapper = db.GetSqlStringCommandWrapper(NewSql)
cmd.CommandTimeout = 180 (seconds) ==> 0 (zero) in order to wait for ever.
myDataSet = db.ExecuteDataSet(cmdl)
i=myDataSet.Tables(0).Rows.Count
If you want to review more of thishttp://msdn.microsoft.com/msdnmag/issues/05/08/DataPoints/
Klaus, I appreciate a lot your help.
Thanks
sql
No comments:
Post a Comment