Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

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

Starting Member

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


Very Important crosS Applying yaK Herder

52326 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

Go to Top of Page

Constraint Violating Yak Guru

352 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.

Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3873 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  
 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.03 seconds. Powered By: Snitz Forums 2000