1

How to connect other pc to database SQL server 2008? I created C# Login form in my PC and it works properly, but when I try to my another PC in LAN I can't login is gives an error "A network-related or instance-specific error occurred while establishing a connection to SQL server". I tried to find a solution but no luck.

This is my sqlconnection object:

SqlConnection conn = new SqlConnection(@"Data Source=jason-PC\SQLEXPRESS; Initial Catalog=db_Lan; User Id=wew; Password=password;");

I have also enabled TCP/IP and remote.

I hope you can help me because I am a beginner.

Brian
  • 5,069
  • 7
  • 37
  • 47
MarckxMan
  • 35
  • 1
  • 8
  • 6
    You have to enable remote access to SQL Server see: [7 things to check to resolve “A network-related or instance-specific error occurred while establishing a connection to SQL Server…](http://www.sswug.org/articlesection/default.aspx?TargetID=44331) – Habib Feb 06 '14 at 18:53
  • 1
    try to handle the firewall of that machine. If you have permissions then disable firewall for few minutes and try to reconnect. If it works then you have to add an exception/rule in firewall. remember to enable firewall again. – Sarvesh Mishra Feb 06 '14 at 18:55
  • SQL Server Express does not enable remote connections by default. Also be sure necessary ports are open in your firewall – Ahmed ilyas Feb 06 '14 at 18:55

1 Answers1

1

as stated earlier - you need to enable remote connections. SQL Server Express does not enable this by default. you also need to enable your firewall access to SQL Server for remote access.

http://blogs.msdn.com/b/sqlexpress/archive/2005/05/05/415084.aspx

http://blogs.msdn.com/b/walzenbach/archive/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008.aspx

Enable remote connections for SQL Server Express 2012

Community
  • 1
  • 1
Ahmed ilyas
  • 5,722
  • 8
  • 44
  • 72