title: Can I access an encrypted SQL Server Compact database in Excel VBA?
body: <p>I want to access an encrypted SQL Server Compact Edition database via VBA.  I can access the database fine when it is not encrypted, but the code breaks when I try to use a password:</p>
  
  <pre><code>pConn.ConnectionString = "PROVIDER=Microsoft.SQLSERVER.CE.OLEDB.3.5;Password=[my_password];Data Source=" &amp; SdfPath
  </code></pre>
  
  <p>I've been following the <a href="http://www.connectionstrings.com/sql-server-compact/" rel="nofollow">connection string example provided here</a> for SQL Server Compact with a password:</p>
  
  <blockquote>
    <p><strong>Encryption enabled</strong></p>
    
    <p>Use this connection string to enable encryption on the database.</p>
    
    <p><em>Data Source=MyData.sdf;Encrypt Database=True;Password=myPassword;
    File Mode=shared read;Persist Security Info=False;</em></p>
    
    <p>The Encrypt Database="True" pair is really not necessary as the presence of the Password-parameter itself turns on encryption for the connection.</p>
  </blockquote>
  
  <p>But why doesn't this work in Excel VBA 2010?</p>