title: Cannot connect to SQL Server hosted on Virtual Machine
body: <p>I have a virtual machine running on my PC running Windows Server 2008 with SQL Server 2012 installed. When I run SQL Server Management Studio on the VM I can connect as such:</p>
  
  <p><a href="http://i.stack.imgur.com/DYdG9.png" rel="nofollow">Image showing Management Studio credentials</a></p>
  
  <p>However, when I run the following C# code outside of the Virtual Machine (VMWare Player) I get an error saying that the server could not be found.</p>
  
  <pre><code>SqlConnection myConnection = new SqlConnection(@"Database=MyDB;Server=WIN-A7D3AQAEQ8C\SQLEXPRESS;Integrated Security=True;connect timeout = 7;");
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll</p>
  </blockquote>
  
  <p>I can ping the Virtual Machine and vice versa. The Virtual Machine's firewall is turned off completely. What am I doing wrong?</p>