title: connecting to a sql server using sqlconnection class
body: <p>I am trying to connect to a Sql Server in my apllication using the following code :</p>
  
  <pre><code>SqlConnection myConnection = new SqlConnection();
  myConnection.ConnectionString = "Data Source = (local);Initial Catalag = Inventory;
                                   Persist Security Info = false;
                                   Integrated Security = true;
                                   Packet Size = 4096;Connect TimeOut = 30";
  myConnection.Open();
  </code></pre>
  
  <p>where Inventory is my database  and it exists on my local machine.</p>
  
  <p>"Error 40: Could not open a Connection to Sql Server" ---error comes while the above code executes.</p>