0

I have a c# application i want to connect it to sql server , the server and the application are used on the same machine , but I application cannot connect to the sql however if I installed the application on another machine and keeping the server in the first server they are connected ! The server is installed on windows 8.

Thanks

Hasan Shouman
  • 2,162
  • 1
  • 20
  • 26

2 Answers2

1

Please do the following -

  1. Make sure your local database server has both Windows Authentication and SQL Server Authentication mode enabled. But

If you are using Windows Authentication then change the connection string to -

connectionString="Data Source=LENOVO;Initial Catalog=APP;Integrated Security=True;"

If you are using SQL Server authentication mode, which it seems since you are providing username yourself then

connectionString="Data Source=LENOVO;Initial Catalog=APP;Integrated Security=False;User ID=sa;Password=111"

Also, APP is usually a reserve keyword in some systems. Its better to avoid such name as the name of the DB.

If you are using default server instance you can use . or (local) instead of LENOVO

brainless coder
  • 6,310
  • 1
  • 20
  • 36
0

Check that the firewall is not preventing you from connecting.