Ms_ Dev

Ms_ Dev

  • NA
  • 236
  • 92.4k

Optimize redundant sproc calls

Sep 1 2016 4:20 AM
Consider this scenario -
SP - dbo. executeMe
the code is as -
 
page1.cs 
  1. function abc()  
  2. {  
  3. .....statements  
  4. execdbo.executeMe//letssay  
  5. values--  
  6. storeresult--  
  7. }  

  8. function cde()  
  9. {  
  10. .....statements  
  11. execdbo.executeMe//letssay  
  12. values--  
  13. storeresult--  
  14. }  

  15. function efg()  
  16. {  
  17. .....statements  
  18. execdbo.executeMe//letssay  
  19. values--  
  20. storeresult--  
  21. }  
 
I have another page lets say page2.cs which has two functions which aslo executes the
  1. function mno()    
  2. {    
  3. .....statements    
  4. execdbo.executeMe//letssay    
  5. values--    
  6. storeresult--    
  7. }    
  8. function pqr()    
  9. {    
  10. .....statements    
  11. execdbo.executeMe//letssay    
  12. values--    
  13. storeresult--    
  14. }  
Now, how i can execute the function only once and get the values all the time.
( USE THE 1ST EXECUTED STATEMENT) all the time without invoking the sp again and again. Causing redundant sp reduces the optimization.
 
Solutions are welcome..

Answers (4)