我在执行datacontext.ExecuteCommand(objectname)时遇到错误
错误:
System.Data.SqlClient.SqlException:超时已过期.操作完成之前经过的超时时间或服务器没有响应.该语句已终止.示例代码:
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;
Run Code Online (Sandbox Code Playgroud)
这里执行插入查询时我得到一个错误System.Data.SqlClient.SqlException:超时已过期.操作完成之前经过的超时时间或服务器没有响应.该语句已终止.
错误页面如下
超时已过期.操作完成之前经过的超时时间或服务器没有响应.该语句已终止.描述:执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息.
异常详细信息:System.Data.SqlClient.SqlException:超时已过期.操作完成之前经过的超时时间或服务器没有响应.该语句已终止.
来源错误:
第914行:其中ft.IsDeleted = 0且ym.IsDeleted = 0且ym.IsApproved = 1");第915行:第916行:dc.ExecuteQuery(InsertCommand);第917行:InsertCommand = string.Empty;第918行:
源文件:d:\ Website\IDCCircle_Staging\Portal\Default.aspx.cs行:916
堆栈跟踪:
[SqlException(0x80131904):超时已过期.操作完成之前经过的超时时间或服务器没有响应.语句已终止.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception,Boolean breakConnection)+2062078 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception,Boolean breakConnection)+5050204 System.Data.SqlClient.TdsParser .ThrowExceptionAndWarning()+234 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,SqlCommand cmdHandler,SqlDataReader dataStream,BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj)+2275 System.Data.SqlClient.SqlDataReader.ConsumeMetaData()+ 33 System.Data. SqlClient.SqlDataReader.get_MetaData()+86 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds,RunBehavior runBehavior,String resetOptionsString)+311 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,Boolean …