mercredi 23 septembre 2015

Check if row exist in SQLite PCL UWP

Im trying to check if a row exist in the sqlite db, its a uwp. All examples i find out there dont work for the SQLite.Net-PCL, dont know why they are different.. If someone have a good link for sqlpcl commands feel free to add that aswell :).

Now to my code and what i have tried:

    private void AdMovieID()
    {
        var sqlpath = System.IO.Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "MovieID.sqlite");

        SQLite.Net.SQLiteConnection conn = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), sqlpath);

//I have the code down below but that dosent work well at all.. :) 

       /* var movies = conn.Table<MovieID>().ToList();
        foreach (var id in movies)
        {
          if (id.ID != App.Moviess.Filmerna[index].id.ToString())
            {
                conn.Insert(new MovieID { ID = App.Moviess.Filmerna[index].id.ToString() });
            }


        }*/
    }

The class i use for the db:

public class MovieID
    {
        public string ID { get; set; }
    }

Aucun commentaire:

Enregistrer un commentaire