trigeminus
asked on
CommandTimeout does not work - The timeout period elapsed prior to completion of the operation or the server is not responding
I try to run time consuming stored procedure, but without success. Execution should take at least a couple minutes.
using (SqlConnection conn = new SqlConnection("Data Source=abc\\sqlexpress;Ini tial Catalog=DataBase;Integrate d Security=True;Connect Timeout=1000"))
{
SqlCommand cmd = new SqlCommand(); cmd.CommandTimeout = 1000;
conn.Open();
cmd = new SqlCommand("Proc", conn);
cmd.CommandType = CommandType.StoredProcedur e;
cmd.Parameters.Add("@x", SqlDbType.Int).Value = x;
cmd.Parameters.Add("@y", SqlDbType.Int).Value = y;
cmd.ExecuteNonQuery();
}
After a short time appears error message:
at System.Data.SqlClient.SqlC onnection. OnError(Sq lException exception, Boolean breakConnection)
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Thanks for any help.
using (SqlConnection conn = new SqlConnection("Data Source=abc\\sqlexpress;Ini
{
SqlCommand cmd = new SqlCommand(); cmd.CommandTimeout = 1000;
conn.Open();
cmd = new SqlCommand("Proc", conn);
cmd.CommandType = CommandType.StoredProcedur
cmd.Parameters.Add("@x", SqlDbType.Int).Value = x;
cmd.Parameters.Add("@y", SqlDbType.Int).Value = y;
cmd.ExecuteNonQuery();
}
After a short time appears error message:
at System.Data.SqlClient.SqlC
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Thanks for any help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER