title: UWP App SQLite Access database in Documents Library
body: <p><strong><em>Q: I can't open a SQLite database in my Documents folder:</em></strong>  </p>
  
  <p>App: Universal Windows (10) Platform<br>
  Development: C#, Visual Studio 2015<br>
  SQLite: Using SQLite.net<br>
  Targets: Windows 10 Desktop and Windows 10 Phone  </p>
  
  <p>Deployment: From Visual Studio or Sideloaded (Do not need Store deployment)  </p>
  
  <pre><code>using SQLite;
  using SQLite;   
  using SQLite.Net;   
  using SQLite.Net.Async;   
  using SQLite.Net.Attributes
  </code></pre>
  
  <h2>I can:</h2>
  
  <p>Open and read from a database included in the project as content:       </p>
  
  <pre><code>using (SQLite.Net.SQLiteConnection conn = new SQLite.Net.SQLiteConnection
  (new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), ".\\mydb.db3"))
  {
  //Read queries
  }
  </code></pre>
  
  <p>Open/Create  and Read/Write a database to the apps workspace:  </p>
  
  <pre><code>string path = Path.Combine
  (Windows.Storage.ApplicationData.Current.LocalFolder.Path,"another.db3");
  
  using (SQLite.Net.SQLiteConnection conn = new SQLite.Net.SQLiteConnection
  (new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), path))
  {
  //CRUD
  }
  </code></pre>
  
  <ul>
  <li>Copy another.db3 to Documents</li>
  <li>From there copy to an External Memory Device (SD Card)</li>
  </ul>
  
  <h1>I can't</h1>
  
  <ul>
  <li>Open the database in Documents or SD</li>
  </ul>
  
  <p>I use a FilePicker to choose the db in Documents or the SD<br>
  I then use the File.Path property when attempting to open the database connection  </p>
  
  <pre><code>Windows.Storage.StorageFile File = await FilePicker.PickSingleFileAsync();  
  string path = File.Path;
  </code></pre>
  
  <p>I get the following error message when I attempt to open that connection:  </p>
  
  <blockquote>
    <p>Exception thrown: 'SQLite.Net.SQLiteException' in SQLite.Net.dll<br>
    SQLite-GetAllVendors: Could not open database file: C:\Users\me\Documents\another.db3 (CannotOpen)</p>
  </blockquote>
  
  <p>Have added SQLite .db and .db3 file associations.  </p>
  
  <pre><code>      &lt;Extensions&gt;
          &lt;uap:Extension Category="windows.fileTypeAssociation"&gt;
            &lt;uap:FileTypeAssociation Name=".db"&gt;
              &lt;uap:DisplayName&gt;SqliteDB&lt;/uap:DisplayName&gt;
              &lt;uap:EditFlags OpenIsSafe="true" /&gt;
              &lt;uap:SupportedFileTypes&gt;
                &lt;uap:FileType&gt;.db&lt;/uap:FileType&gt;
                &lt;uap:FileType&gt;.db3&lt;/uap:FileType&gt;
              &lt;/uap:SupportedFileTypes&gt;
            &lt;/uap:FileTypeAssociation&gt;
          &lt;/uap:Extension&gt;
        &lt;/Extensions&gt;
      &lt;/Application&gt;
    &lt;/Applications&gt;
  </code></pre>
  
  <p>Have added the relevant Capabilities</p>
  
  <pre><code>  &lt;Capabilities&gt;
      &lt;Capability Name="internetClient" /&gt;
      &lt;uap:Capability Name="picturesLibrary" /&gt;
      &lt;uap:Capability Name="documentsLibrary" /&gt;
      &lt;uap:Capability Name="videosLibrary" /&gt;
      &lt;uap:Capability Name="userAccountInformation" /&gt;
      &lt;uap:Capability Name="removableStorage" /&gt;
      &lt;DeviceCapability Name="webcam" /&gt;
      &lt;DeviceCapability Name="location" /&gt;
    &lt;/Capabilities&gt;
  </code></pre>
  
  <p><strong><em>Surely there is some way to open a SQLite database in Documents or on a memory stick form a Universal Windows (10) app.</em></strong><br>
  Thx in advance</p>