472,118 Members | 1,091 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,118 software developers and data experts.

Can't pass Recordset in recursive function

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
1 1879
acoder
16,027 Expert Mod 8TB
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.

Similar topics

3 posts views Thread by Davy | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.