title: Cannot connect to SQL Server in Visual Studio
body: <p>I installed SQL Server and Visual Studio and tried to do my university project.</p>
  
  <p>I can connect to SQL Server in Management Studio but can not connect in Visual Studio!</p>
  
  <ul>
  <li>Remote connecting is enabled</li>
  <li>all services are running</li>
  <li>and everything is ok but I dont know why I get this error :</li>
  </ul>
  
  <blockquote>
    <p>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 the ...</p>
  </blockquote>
  
  <p>What's wrong with this code?</p>
  
  <pre><code> SqlConnection sqcon = new SqlConnection("Data Source=.;Initial Catalog=Badan_Sazi;Integrated Security=True");
  
   SqlCommand com = new SqlCommand();
   com.Connection = sqcon;
   com.CommandText = "SELECT tbl_morabi.family   as 'lname'  FROM tbl_morabi";
  
   com.Connection.Open();
  </code></pre>
  
  <p>I also tried <code>.</code>, <code>localhost</code>, <code>my pc name</code> ... same error anyway</p>
  
  <ul>
  <li>Visual Sudio 2012</li>
  <li>SQL Server Express 2012</li>
  </ul>