We are getting Timeout expired exception on SqlConnection.Open().
Below is the code :
public int ExecuteNonQuery(SqlParameter[] param, string strSPName)
{
using (SqlConnection conn = new SqlConnection(_connStr))
{
int i = 0;
using (SqlCommand cmd = new SqlCommand(strSPName, conn))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddRange(param);
conn.Open();
i = cmd.ExecuteNonQuery();
}
return i;
}
}
Does the return
keyword inside the using
statement leaving the connection to opened and hence this issue?