Hello:
1) I have several stored procedures that returns thousands of rows.
2) The web UI will page the data and show say 200 rows at a time.
3) On pagination, the stored procedure is getting executed every time and therefore takes longer for my service to return the data.
4) Instead of caching the data in the service, I would like to store the data in the SQL Server tempdb by making use of the # tables. So the way this will work is that the first time the stored procedure is executed, the temp table will be created in the SQL
Server and the data stored in the temp table. Upon subsequent pagination of the data, the stored procedure is not re-executed but the data will be simply returned by querying the temp table previously created.
5) In order for the temp tables to remain in session, the original spid (@@SPID) must remain by keeping the SqlConnection open and not closing it after each call.
What's the best way to store the SqlConnections in the cache in order to achieve the behavior explained above.
Thanks!