cancel
Showing results for 
Search instead for 
Did you mean: 

TestComplete and SQL databases - Restoring per test

SOLVED
Highlighted
Occasional Contributor

Re: TestComplete and SQL databases - Restoring per test

I tried adding an extra '\' for the folder but am still getting:

 

[DBNETLIB][ConnectionOpen(Connect()).]SQL Server does not exist or access denied.

Highlighted
Community Hero

Re: TestComplete and SQL databases - Restoring per test

Verify.

 

this is your old line of code

 

"Provider=SQLOLEDB;SERVER=\\UXXXXXXX\MSSQLSERVER2017;Database=DBXXXXX;User Id=UserXXXX;Password=PassXXXXX;"

This should be your new line of code

 

"Provider=SQLOLEDB;SERVER=\\\\UXXXXXXX\\MSSQLSERVER2017;Database=DBXXXXX;User Id=UserXXXX;Password=PassXXXXX;"

Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Highlighted
Community Manager

Re: TestComplete and SQL databases - Restoring per test

Hi @twe69,

 

Does the updated line (which tristaanogre suggested) work for you?

 

 

---------
Tanya Gorbunova
SmartBear Community Manager

 Join SmartBear Connect next April in Boston to meet with software development, API and testing experts from around the world! Get your ticket today!
Highlighted
Occasional Contributor

Re: TestComplete and SQL databases - Restoring per test

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(); }
 

 

View solution in original post

Highlighted
Community Manager

Re: TestComplete and SQL databases - Restoring per test

I'm happy to hear that the issue has been resolved. Thanks for sharing the solution with us.

 

 

---------
Tanya Gorbunova
SmartBear Community Manager

 Join SmartBear Connect next April in Boston to meet with software development, API and testing experts from around the world! Get your ticket today!