SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Problem when get data from SQL Server
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

demons
Starting Member

Vietnam
6 Posts

Posted - 03/27/2013 :  23:48:31  Show Profile  Reply with Quote
Hi all
I have problem when execute the query
When i use the tools (SQL Server Management Studio), takes 5s to see the data result, but when run the problem (code by c#) takes 15 mins or more to get result and show on gird
When i remote to server, i see that, server is working with 90-98 percent, and memory used over, i must restart and this problem will be solve

Please give me the reasons

Thanks

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 03/28/2013 :  05:11:00  Show Profile  Reply with Quote
can be due to lots of connection opened from client. see how database call is happening from app.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

djj55
Constraint Violating Yak Guru

USA
336 Posts

Posted - 03/28/2013 :  09:06:55  Show Profile  Reply with Quote
Do not know if this will help but make sure the SQL Server's max memory is set.

djj
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3699 Posts

Posted - 03/28/2013 :  10:07:13  Show Profile  Reply with Quote
How are you executing the query from C#? Are you using ADO.Net, or something else such as LINQ? If you are using LINQ, what it sends to the server or how it executes the query could cause the problem.

The memory and CPU problems may not necessarily be because of this query. Are there other jobs/users/processes running on the server/system? It may be a coincidence that the memory and cpu spiked up.

Certainly, do look at the max memory setting on the server as djj55 suggested. Also, see if you can run profiler or trace and see what the C# code is sending to the server.

Are the query parameters the same when you run from C# code and from SSMS? If they are not, try to make them the same.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000