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

查看:36
本文介绍了获取和设置SQL超时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行linq查询时,出现以下错误:

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.

谢谢.

推荐答案

如果您使用的是Linq2Sql DataContext,则可以在YourDataContext.CommandTimeout上使用.

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

对于SqlConnectionCommandTimeoutSqlCommand对象的属性.

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

这篇关于获取和设置SQL超时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆