cancel
Showing results for 
Search instead for 
Did you mean: 

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

SOLVED
Highlighted
Community Hero

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

@jkrolczy :

Hi,

 

Just the idea of the last hope: to my knowledge, TestComplete's ADO object namespace is a wrapper over Delphi's one. I never used it in my code but always used pure native ADO objects and never had problems like yours. The transition from TestComplete's ADO to native ADO should not be difficult. What if you give it a try?

 

P.S. Documentation for the native ADO can be found at Microsoft's MSDN. Sorry, but I don't have a direct link at hand.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Frequent Contributor

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

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;
  AConnection.Open();
  // Execute a simple query
  RecSet = AConnection.Execute_("SELECT * FROM Sites where Status = 0");

  RecSet.MoveFirst();

 

  while(! RecSet.EOF)
  {
    Log.Message(RecSet.Fields.Item("name").Value);
    RecSet.MoveNext();
  }

  AConnection.Close();
}

 

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.

 

 

JamesK

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors