Forum Discussion

Philip_Baird's avatar
Philip_Baird
Community Expert
12 years ago

ADOCommand,Connection property not supported

Hi I am having a problem assigning an active connection to an (Oracle) ADOCommand in Test Complete 9.30.3373.7, i.e.




function test() {


  var conn = ADO.CreateADOConnection();


  conn.ConnectionString = csb.connectionString();


  conn.LoginPrompt = false;


  


  conn.Open();


  


  var cmd = ADO.CreateADOCommand();


  cmd.Connection = conn;



fails at the last line with a Microsoft JScript runtime error "Object does not support this property or method" (I have proven the Connection to be valid and open).



If I replace cmd.Connection with  cmd.ActiveConnection as per http://support.smartbear.com/viewarticle/30699/ I still get the same error.



Is this working as intended or a bug, in which case the documentation is in error?

 


  • Hi Phil,


     


    Try the following code:




    function TestProc()


    {


      var RecSet, Cmd;


      Cmd = ADO.CreateADOCommand();


      Cmd.ConnectionString = csb.connectionString();


      Cmd.CommandText = "<Query>";


      Cmd.CommandType = cmdText;


     


      RecSet = Cmd.Execute();


      RecSet.MoveFirst();


      while (! RecSet.EOF)


      {


        //...


        RecSet.MoveNext();


      }


    }