title: Windows 8/RT delete from sqlite using linq
body: <p>I have SQLite database in isolated storage in Windows Store App.<br>
  I use <code>SQLite for Windows Runtime</code> <br> 
  When i want to delete all table entry I use follow method:</p>
  
  <pre><code>  public static async void DeleteAllProjects()
      {
          var storageFile = await ApplicationData.Current.LocalFolder.GetFileAsync("myDb.sqlite");
          using (var db = new SQLiteConnection(storageFile.Path))
          {
              try
              {
                  db.DeleteAll&lt;Projects&gt;();
              }
              catch
              (Exception ex)
              {
                  Debug.WriteLine("Delete error   " + ex.Message);
              }
          }
      }
  </code></pre>
  
  <p>All work like a charm. <br>
  But when i need to delete part of entries:</p>
  
  <pre><code> public static async void Delete(List&lt;Projects&gt; projects)
      {
          var storageFile = await ApplicationData.Current.LocalFolder.GetFileAsync("myDb.sqlite");
          using (var db = new SQLiteConnection(storageFile.Path))
          {
              try
              {
                  foreach (var project in projects)
                  {
                      var existingProject = (db.Table&lt;Projects&gt;().Where(
                          p =&gt; p.id == project.Id)).FirstOrDefault();
                      if (existingProject != null)
                      {
                            db.Delete&lt;Projects&gt;(existingProject);
                      }
                  }
              }
              catch
              (Exception ex)
              {
                  Debug.WriteLine("Delete error   " + ex.Message);
              }
          }
      }
  </code></pre>
  
  <p>I handled exeption with</p>
  
  <pre><code>ex.Message = "Cannot delete Projects: it has no PK" string
  </code></pre>
  
  <p>Can somebody help me?</p>