0
Я хочу установить ограничение по времени для определенного запроса на выборку.Установить временной интервал для запроса БД
Как это сделать?
try
{
using (SqlConnection connection = new SqlConnection(ConString)
{
using (SqlCommand command = new SqlCommand())
{
command.CommandText = sp;
command.CommandType = CommandType.StoredProcedure;
command.Connection = connection;
command.Connection.Open();
using (SqlDataReader reader = command.ExecuteReader())
{
string role = "";
if (reader.Read())
role = reader.GetString(0);
reader.Close();
}
}
}
}
catch (Exception ex)
{
//throw new Exception(string.Format("DBLayer failure in {0}: {1}", sp, ex.Message), ex);
}