cancel
Showing results for 
Search instead for 
Did you mean: 

Compare two DBTables objects

Highlighted
Contributor

Compare two DBTables objects

Hi, 

     I need to compare data from two different database servers. Both are SQL Server, but different connection strings. So I create two Stores | DBTables, say DBTables1 and DBTables2, then compare if records in DBTables1 are same as DBTables2. It works in most cases, sometimes it doesn't. If my SQL query doesn’t return any record, which is one of normal cases,  then the DBTables cannot be created. Is this configured in the Project Properties? Or should I use other way to do this test?



    Thanks a lot!



Nancy


1 REPLY 1
Highlighted

RE: Compare two DBTables objects



Hi Nancy,






Currently, the DBTable Checkpoint feature of TestComplete does not allow saving baseline data without any records. I have registered your request as a suggestion in our database.






In the meantime, you can use the ADO extension to check whether there are any records recorded by a request.








function testADORequest()


{


  var Cmd = ADO.CreateADOCommand();


  Cmd.ConnectionString = "Driver={SQL Server Native Client 10.0};Server=myServer;Database=myDatabase; Uid=myUsername;Pwd=myPassword;";


  Cmd.CommandText = "SELECT * FROM USERS WHERE PEN_NAME = 'Nancy'";


  Cmd.CommandType = cmdText;






  var RecSet = Cmd.Execute();


  if (RecSet.EOF == true) {


    Log.Message("The recordset is empty");


  }


  else {


    Log.Message("The recordset contains items");


  }


}


--
Dmitry Nikolaev

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors