Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:

C#
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;


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
Posted
Updated 19-Apr-12 1:45am
v3

1 solution

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[^]
 
Share this answer
 
Comments
Jyothi.Gowda 20-Apr-12 1:38am    
Thanks For your Reply,
I have checked my connection string and time out as well, but the same query is working fine with my local system , when i integrating the same lines of code in server i am facing this problem.

Let me know the cause of this problem...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900