By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,569 Members | 1,394 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,569 IT Pros & Developers. It's quick & easy.

Can't pass Recordset in recursive function

P: 1
Hi

Am facing a problem while passing Recordset object in a recursive function or to 3rd level of function. Please help.

My javascript code is:

Expand|Select|Wrap|Line Numbers
  1. function fn1()
  2. {
  3.  
  4.     var connPatient = new   ActiveXObject("ADODB.Connection")
  5.     connPatient.open( "", "", "" );
  6.     var rsPatientList = new ActiveXObject("ADODB.Recordset");
  7.     var strQuery = "";
  8.      rsPatientList.open ( strQuery , connPatient, 3 );
  9.      fn2( rsPatientList);
  10.  
  11. }
  12.  
  13. function fn2( rsObj )
  14. {
  15.  
  16. alert( rsObj.recordCount); // Returning correct result
  17. fn3( rsObj );
  18.  
  19. }
  20.  
  21. function fn3( rsObj1 )
  22. {
  23.  
  24. alert( rsObj1.recordCount); // Returning error
  25. fn3( rsObj );
  26.  
  27. }


Thank you.
Apr 7 '07 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
For recursion, you need an end case - fn3 will be called repeatedly in an endless loop. Also, rsObj doesn't exist within fn3.
Feb 5 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.