iebidan Posted December 21, 2004 Posted December 21, 2004 Hi guys, hey I've been out of the forums for a long time, also out of programming, but now we've a problem and prolly you know the answer to this I've a stored procedure that takes too long to execute, it processes large amounts of information (up to 750 million rows) but when we call it (using the following code) we get a timeout, how can I make my application wait til the procedure is done? also this stored procedure calls 11 user defined functions. If I execute the procedure using Query Analyzer it runs perfectly and I never get a timeout. How can I solve this? string sDate = "20041130"; string sLastDate ="20041031"; string sConnect = "server=--;UID=--;PWD=--;DATABASE=--;"; SqlConnection Conn = new SqlConnection(sConnect); SqlCommand ObjCmd = new SqlCommand("sp_inv",Conn); ObjCmd.CommandType = CommandType.StoredProcedure; SqlParameter DateParam = new SqlParameter("@DATE",sDate); ObjCmd.Parameters.Add(DateParam); SqlParameter LastDateParam = new SqlParameter("@LASTDATE",sLastDate); ObjCmd.Parameters.Add(LastDateParam); try { Conn.Open(); ObjCmd.ExecuteNonQuery(); } catch (SqlException ex) { MessageBox.Show(ex.Message.ToString()); } finally { Conn.Close(); Conn.Dispose(); } Thanks in advance Quote Fat kids are harder to kidnap
*Gurus* Derek Stone Posted December 22, 2004 *Gurus* Posted December 22, 2004 Set the SqlCommand.CommandTimeout property. Quote Posting Guidelines
iebidan Posted December 27, 2004 Author Posted December 27, 2004 Yeah, I did, I found out this 10 minutes after posting this, thanks anyway, sorry for the delay on posting the solution, I was trying to set the timeout in the connection string. Sometimes my brains seems to work in a very slow way Quote Fat kids are harder to kidnap
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.