title: How to connect to SQL Server using oledbConnection
body: <p>I am trying to connect to SQL Server with OledbConnection but its showing error</p>
  
  <blockquote>
    <p><em>Server does not exist or access denied</em></p>
  </blockquote>
  
  <p>My code is</p>
  
  <pre><code>using (OleDbConnection conn = new OleDbConnection(ConnectionString))
  {
     try
     {
        // test the connection with an open attempt
        conn.Open();
        this.Dispose();
     }
     catch (Exception ex)
     {
        // inform the user if the connection was not saved
        MessageBox.Show(ex.Message, "Connection Test");
     }
  }
  </code></pre>