cancel
Showing results for 
Search instead for 
Did you mean: 

TestComplete and SQL databases - Restoring per test

SOLVED
twe69
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.

tristaanogre
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
[Hall of Fame]
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
TanyaYatskovska
Community Manager

Re: TestComplete and SQL databases - Restoring per test

Hi @twe69,

 

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

 

 

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
twe69
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

TanyaYatskovska
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 Yatskovskaya
SmartBear Community and Education Manager

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