获取和设置SQL超时?[英] Getting and Setting SQL Timeout?

本文是小编为大家收集整理的关于获取和设置SQL超时?的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

运行 linq 查询时,我收到以下错误:

<块引用>

超时.超时时间在完成之前经过操作或服务器不回应.

我很想知道如何查看和修改这个值,看看它是否需要更大或者我的查询是否有问题.我的查询过去一直有效,所以我想一些超时设置自上次工作以来已更改.

谢谢.

推荐答案

如果你使用的是 Linq2Sql DataContext,它可以在 YourDataContext.CommandTimeout 获得.

对于 SqlConnection,CommandTimeout 是 SqlCommand 对象的属性.

本文地址:https://www.itbaoku.cn/post/1556844.html

问题描述

When running a linq query, I get the following error:

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

I'm curious to know how I can view and modify this value to see if this just needs to be bigger or if there's something wrong with my query. My query has worked in the past, so I would like to think some timeout setting was changed since it was last working.

Thanks.

推荐答案

If you're using a Linq2Sql DataContext, it's available at YourDataContext.CommandTimeout.

For a SqlConnection, the CommandTimeout is a property of the SqlCommand object.