WojtexDeveloper
New member
- Joined
- Aug 22, 2025
- Messages
- 1
- Programming Experience
- 10+
Hello.
I've created a large WPF application in C#, where I work with an MS-SQL database using ADO.Net controls.
I'm using the System.Data.SqlClient library. I read and write to the database by calling stored procedures. These procedures are large and heavy, containing several subqueries, temporary tables, variables, and always returning data via SELECT.
For some time now, I've been having connection stability issues. I have a large form that's primarily used by the user with a large amount of data.
As long as the application has frequent user interaction (the user frequently clicks on individual options to call stored procedures from the database), everything runs smoothly. However, if the user stops working in the application, a significant slowdown in procedure execution is noticeable after a few seconds. When there's continuous work, the execution time of the heaviest procedure is less than 1 second. After this slowdown, it's a few seconds. This happens with all called procedures. The second time, the called procedure responds quickly. I have the impression that when there's no user interaction, .Net puts the connection to sleep. Is this possible?
It looks like a "change start" because the application then behaves as if it were starting. The first call to the stored procedure is then slower than the next.
I run all my queries on a single shared connection, which I open at application startup.
Has anyone else had a similar problem?
Where can I find a solution to ensure that the procedures always run quickly, regardless of whether there's any activity in the application or not?
I've created a large WPF application in C#, where I work with an MS-SQL database using ADO.Net controls.
I'm using the System.Data.SqlClient library. I read and write to the database by calling stored procedures. These procedures are large and heavy, containing several subqueries, temporary tables, variables, and always returning data via SELECT.
For some time now, I've been having connection stability issues. I have a large form that's primarily used by the user with a large amount of data.
As long as the application has frequent user interaction (the user frequently clicks on individual options to call stored procedures from the database), everything runs smoothly. However, if the user stops working in the application, a significant slowdown in procedure execution is noticeable after a few seconds. When there's continuous work, the execution time of the heaviest procedure is less than 1 second. After this slowdown, it's a few seconds. This happens with all called procedures. The second time, the called procedure responds quickly. I have the impression that when there's no user interaction, .Net puts the connection to sleep. Is this possible?
It looks like a "change start" because the application then behaves as if it were starting. The first call to the stored procedure is then slower than the next.
I run all my queries on a single shared connection, which I open at application startup.
Has anyone else had a similar problem?
Where can I find a solution to ensure that the procedures always run quickly, regardless of whether there's any activity in the application or not?