title: Can't open a password protected SQLite 3 database with C#
body: <p>I'm having an issue using a password protected SQLite database, using System.Data.SQLite.</p>
  
  <p>I'm using DB Browser for SQLite to create the database and set the password. With DB Browser I have no issues opening, entering the password viewing data, then closing the database.</p>
  
  <p>So with .NET 4.6.2 and System.Data.SqLite 1.0.105.2 the following code snippet does not work I keep getting a "file is encrypted or is not a database" error.</p>
  
  <pre><code>namespace licensekeygeneration
  {
      using NLog;
      using NLog.Extensions.AzureTableStorage;
      using System;
      using System.Data.SQLite;
      using System.Linq;
      using System.Windows;
  
  /// &lt;summary&gt;Interaction logic for App.xaml&lt;/summary&gt;
  public partial class App : Application
  {
      /// &lt;summary&gt;Make sure that NLog is running&lt;/summary&gt;
      private static Logger logger = LogManager.GetCurrentClassLogger();
  
      /// &lt;summary&gt;Run before the application starts up&lt;/summary&gt;
      void App_Startup(object sender, StartupEventArgs e)
      {
          try
          {
              // Set link to the SQLite database and grab the logging endpoint
              string dataSource = @"Data Source=c:\users\fred\desktop\database.db;Version=3;Page Size=1024;Password=ABCD";
              SQLiteConnection conn = new SQLiteConnection(dataSource);
  
              DataContext LocalDB = new DataContext(conn);
  
              // Sets the target for NLog in code 
              string strNlog = LocalDB.GetTable&lt;TblS3Settings&gt;().Where(item =&gt; item.StrSettingName.Equals("NlogEndPoint") &amp;&amp; item.BoolIsValid.Equals(true)).ToList().FirstOrDefault().StrSettingValue;
              var azureStorageTarget = (AzureTableStorageTarget)LogManager.Configuration.FindTargetByName("AzureTableStorage");
              azureStorageTarget.ConnectionString = strNlog;
          }
          catch (Exception ex)
          {
              // Problem with the database or the connection so error out
              MessageBox.Show("There is an issue with the internal database\n" + ex.Message, "Application", MessageBoxButton.OK, MessageBoxImage.Hand);
              Current.Shutdown();
          }
  
          // Logging OK and we have an attached database so lets start
          MainWindow.Show();
      }
  }
  </code></pre>
  
  <p>If I remove the password from the database using DB Browser for SQLite and I change the following line:</p>
  
  <pre><code>string dataSource = @"Data Source=c:\users\fred\desktop\database.db;Version=3;Page Size=1024;";
  SQLiteConnection conn = new SQLiteConnection(dataSource);
  </code></pre>
  
  <p>I get the information I expect and life is good, So am I missing something with System.Data.SQLite as I just can't get it to work as I expected. </p>
  
  <p>If it matters I'm using Visual Studio 2017 on Windows 10 64Bit.</p>
  
  <p>Thanks.</p>