I have a SQL query that I used my vb.net application to run it, but i have a problem when It exceeds to its command timeout property. I set it to 300, any tips or suggestions?
here is the snippet of my code in vb.net
.ExecuteQuery("exec spCentrIX_PracticeSet '" & oCompany & "','" & .SecDatabaseName & "'", sDataSet)
Application.DoEvents()
.ExecuteQuery("exec spCentrIX_PracticeSet '" & oCompany & "','" & .SetDatabaseName & "'", sDataSet)
Application.DoEvents()
.ExecuteQuery("exec spCentrIX_PracticeSet '" & oCompany & "','" & .TranDatabaseName & "'", sDataSet)
Application.DoEvents()
same script that run three times. this script gets all the data from the 3 databases which runs okie. however, when it is running…it exceeds the connection timeout of my code.
Setting the timeout to zero will never time out, this is not advised in a production environment but if you really really want to wait till it is finished it will do the trick. You would want to investigate ways to optimise the query if possible. Also run it asynchronously, maybe using backgroundworker.
http://www.codeproject.com/Articles/20627/BackgroundWorker-Threads-and-Supporting-Cancel