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)
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 \.