cancel
Showing results for 
Search instead for 
Did you mean: 

SQL Server does not exist or access denied- ADO Connection

SOLVED
Highlighted
Occasional Contributor

SQL Server does not exist or access denied- ADO Connection

I am not abel to connect to database and execute query. Test complete throws an err that "

 

function SQLdbconnection()

{

 var AConnection, RecSet;
  // Create a Connection object
  AConnection =  ADO["CreateADOConnection"]()

  // Specify the connection string
  AConnection["ConnectionString"] = "Provider=SQLOLEDB;Data Source=192.168.0.98\QASQL;User ID=sa;Password=somepasword;Initial Catalog=mydbqa;Persist Security Info=False";
  
  // Suppress the login dialog box
  AConnection["LoginPrompt"] = 0;
  AConnection["Open"]();

  // Execute a query
  RecSet = AConnection["Execute_"]("Select * from tax");


   RecSet["MoveFirst"]();
  while (!RecSet["EOF"])
  {
    Log["Message"](RecSet["Fields"]("tax1_name")["Value"], RecSet["Fields"]("tax2_name")["Value"]);
    RecSet["MoveNext"]();
  };
  AConnection["Close"](); 

}

On executing above code I receive an error that "JScript runtime error. [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied"

 

What wrong I am doing ?


Otherinformation: 

 

- My Testcomplete information: Version: 12.60.5545.7 x64.
- Microsoft Windows 10 Enterprise, 64-bit (10.0 Build 17763)
Microsoft SQL Server 2012 (SP1) - 11.0.3000.0 (Intel X86)
Oct 19 2012 13:43:21
Enterprise Edition on Windows NT 6.2 <X64> (Build 9200: ) (WOW64)

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: SQL Server does not exist or access denied- ADO Connection

While you are using C#Script, under the covers it is just JScript with some additional syntax rules applied.  Because of that, if you're going to use the \ character in a string, you should double it up so that it actually is interpreted as a \.


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
Extensions available
3 REPLIES 3
Community Hero

Re: SQL Server does not exist or access denied- ADO Connection

While you are using C#Script, under the covers it is just JScript with some additional syntax rules applied.  Because of that, if you're going to use the \ character in a string, you should double it up so that it actually is interpreted as a \.


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
Extensions available
Occasional Contributor

Re: SQL Server does not exist or access denied- ADO Connection

@tristaanogre  Ohh Thanks alot Smiley Happy

Contributor

Re: SQL Server does not exist or access denied- ADO Connection

most common problem with the paths and connection string we need ultra careful to use double slash or add @ before the string it should work.
New Here?
Join us and watch the welcome video:
Watch the new Interview