jeudi 24 septembre 2015

Check if table exist in SQLite-PCL

Im stuck with how to check if a table alredy exist. I have been searching but like many times before i cant find good examples.

The ones i find on SQLite dont work with the PCL version.. cant understand why tho.. so if anyone have a good site where to go please feel free to add them.

This is the ones i have used: http://ift.tt/1L7WLkj

http://ift.tt/1KMgCU5

This is my code on how i have tried to check it, but his only check the path.. wich alwasy exist.. not a smart solution when i tought about it :).

private void LikeItButton_Click(object sender, RoutedEventArgs e)
        {
            var sqlpath = System.IO.Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "Filmdb.sqlite");

            using (SQLite.Net.SQLiteConnection conn =
                new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), sqlpath))
            {
                if (File.Exists(sqlpath))
                {
                    AdMovieID();
                }
                else
                {
                    conn.CreateTable<MovieID>();
                    AdMovieID();
                }
            }
        }

Aucun commentaire:

Enregistrer un commentaire