Forum Discussion

twe69's avatar
twe69
Occasional Contributor
6 years ago

TestComplete and SQL databases - Restoring per test

Hi there,   Just looking at ways of implementing a way to restore a test SQL database back to it's original condition once a load of TestComplete tests run against it. I have found this link bu...
  • twe69's avatar
    twe69
    6 years ago

    Unfortunately it didn't however I was able to get some help from a developer within our company and have got the following working:

     

    function TestProc()
    {
    var Qry;
    var con;
    // Create a query
    Qry = ADO.CreateADOQuery();
    con = ADO.CreateADOConnection();
    con.ConnectionString = "Provider=MSOLEDBSQL.1;User ID=XX;Password=XX;Initial Catalog=XXXXDB;Data Server=computer\\sqlserverinstance,1433;"
    con.CommandTimeout = 1000
    con.LoginPrompt = false;
    con.Open() Qry.ConnectionString = con.ConnectionString; Qry.SQL = "SELECT * FROM Users"; queryResult = Qry.FieldCount; // Closes the query con.Close(); }