title: Connecting to SQL Server database using default connection string from C#
body: <p>I've been trying to make a connection with my SQL Server database (<code>Mynewdatabase</code>) using the default connection string that was generated (supposedly) when I added the data source for this project. However, I'm thus far unable to make a connection: I'm getting an error that "the server was not found or was not accessible".</p>
  
  <p>This my code. Thanks so much for any help you can offer:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Data.SqlClient;
  
  namespace Parsevcf2sql
  {
  class Program
  {
      static void Main(string[] args)
      {
          // here is where I get what I believe is an appropriate connection string
          string cs = Parsevcf2sql.Properties.Settings.Default.MynewdatabaseConnectionString;
          SqlConnection myconnection = new SqlConnection(cs);
  
          Console.WriteLine(cs);
  
          try
          {
              myconnection.Open();
              Console.WriteLine("This worked!");
          }
          catch (Exception e)
          {
              Console.WriteLine(e.ToString());
          }
      }
    }
  }
  </code></pre>