执行linq时,执行插入命令System.Data.SqlClient.SqlException:超时已过期.操作完成之前已过超时时间,或者服务器未响应.... [英] When executing linq execute insert command System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding....

查看:997
本文介绍了执行linq时,执行插入命令System.Data.SqlClient.SqlException:超时已过期.操作完成之前已过超时时间,或者服务器未响应....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

执行datacontext时出现错误.ExecuteCommand<表名>(对象名)

错误:

System.Data.SqlClient.SqlException:超时已过期.在操作完成之前超时时间已过,或者服务器没有响应.该语句已终止.


示例代码:

Hello,

I got an error while executing the datacontext.ExecuteCommand<tablename>(objectname)

Error:

System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated.


Sample code:

Datacontext context = new Datacontext();
tablename tb=new tablename();

string DeleteQuery="delete from table A";
context.ExecuteCommand<tb>(DeleteQuery);
DeleteQuery=string.empty;


string InsertQuery="Insert into table B(a,b,c,d)Select table from C Union All Select Table from D";
context.ExecuteCommand<tb>(InsertQuery);
InsertQuery=string.empty;



在执行插入查询时,我在这里遇到错误System.Data.SqlClient.SqlException:超时已过期.在操作完成之前超时时间已过,或者服务器没有响应.该语句已终止.


请对此提供任何帮助....

很快回复....


在此先感谢,

问候,
Jyothi HN



here while executing insert query i m getting an error System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated.


Please can any one help on this....

Reply Soon....


Thanks In Advance,

Regards,
Jyothi HN

推荐答案

检查是否正确连接了SQL Server.
另外,如果您正在使用ASP.NET,则可以设置超时,为此,请参见以下链接:


http://forums.asp.net/t/1389167.aspx/1 [ ^ ]
check whether are properly connected with SQL server or not.
Also, you can set timeout if you are working on ASP.NET, for this see the following link:


http://forums.asp.net/t/1389167.aspx/1[^]


这篇关于执行linq时,执行插入命令System.Data.SqlClient.SqlException:超时已过期.操作完成之前已过超时时间,或者服务器未响应....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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