Forum Discussion

jkrolczy's avatar
Regular Contributor
5 years ago

TestComplete: SQL: ADO.CreateADOCommand: After a period of run time- Object is no longer valid.

I have a test script in which I am doing a series of SQL queries using ADO. I would like to use these in a for - loop to go through a couple of servers in the same script. I have them broken ou...
  • jkrolczy's avatar
    5 years ago

    Current status on this issue:


    I went back to my ADO code approach and changed it up to follow an example from TestComplete help
    and I added the increase  connection CommandTimeout.


    The below is a piece of the code in place for my scripts.


    function TRANSsvr()
      var AConnection, RecSet;
      // Create a Connection object
      AConnection = ADO.CreateADOConnection();
      AConnection.CommandTimeout = 120;
      // Specify the connection string
      AConnection.ConnectionString = "Provider="SQLNCLI11";Server="TRANSsvr";Database=Primary;Trusted_Connection=yes";
      // Suppress the login dialog box
      AConnection.LoginPrompt = false;
      // Execute a simple query
      RecSet = AConnection.Execute_("SELECT * FROM Sites where Status = 0");



      while(! RecSet.EOF)



    The scripts now go past ~24 sec barrier I kept hitting to where I lost my connection Obj.


    I am happy with this approach now and can close off on these scripts and this thread.


    Thanks all again for you assistance.