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

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Problem when get data from SQL Server

Author  Topic 

demons
Starting Member

6 Posts

Posted - 2013-03-27 : 23:48:31
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

52326 Posts

Posted - 2013-03-28 : 05:11:00
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

352 Posts

Posted - 2013-03-28 : 09:06:55
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
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-03-28 : 10:07:13
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
   

- Advertisement -