What you're asking for is nearly impossible to respond to without knowing how you're accessing your data, the database schema, as well as how the application requests and responds to data.
The accessing of data should be done asynchronously such that the application doesn't hang up while the request takes place. Since I can't give an exact answer without knowing the full technology stack, I can only suggest you search the specific error(s) on your favorite search engine. Typically, if the server spins up a long running process, such as accessing lots of data through a stored procedure, it is best to look at the server side and try to understand why it takes a long time and what you can do to reduce the time it takes to run.
There are several applications out there that can help you debug what is going on through the client application. Fiddler is one such application where you can see which requests are made and how they are being satisfied by the server.
Here's Microsoft's documentation on the error, FWIW.