0

I am using SQL Server authentication for login through SQL Server Management Studio and I can access SQL Server. However, my desktop application cannot establish a connection to the server. I use the following connection string:

Server=PC-ADMIN\SQLEXPRESS; Database= Cafe; User=name; Pwd=password;

Please help.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Sonam
  • 87
  • 2
  • 9
  • 1
    Well - do you get an *error* ? If so, please post that error here - complete and precise error message(s) and all – marc_s Jun 13 '17 at 06:47
  • the error message I get is : "a network-related or instance-specific error occurred while establishing a connection to sql server. The server was not found or was not accessible. verify that the instance name is correct and that sql server is configured to allow remote connection." – Sonam Jun 13 '17 at 06:54
  • Possibly a firewall issue – SSS Jun 13 '17 at 07:35
  • How do I address firewall issue . any suggestion? thanks @SSS – Sonam Jun 13 '17 at 07:37
  • Have you tried using `localhost` or `.` as a servername instad of `PC-ADMIN` ? `Server=.\SQLEXPRESS; Database=Cafe; User=name; Pwd=password;` – Magnus Jun 13 '17 at 12:26
  • To see if it is a firewall issue, disconnect from the internet and then temporarily turn your firewall off to see if your app starts working. If so, then you will need to add a firewall exception: https://learn.microsoft.com/en-us/sql/sql-server/install/configure-the-windows-firewall-to-allow-sql-server-access – SSS Jun 14 '17 at 00:31
  • @Magnus sorry for my late response. It works as you suggested. thanks a lot. – Sonam Jun 21 '17 at 10:05

0 Answers0