Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Sunday, March 6, 2016

Local Storage (SQLite) Using Windows 10 UWP Apps


Local Storage (SQLite) Using Windows 10 UWP Apps

The Windows 10 Universal app local storage using SQLite database. Step-by-step implementation.
 Step 1:
Create new universal project / library using VS2015 RTM Version
Step 2:
Install “sqlite-uap-3081101.VSIX “from Extensions and Updates

VS 2015 -- Tools --Extensions and update -- search sqlite-uap -- Click Install -- Restart VS 2015




Step 3:

The next step is to add the SQLite.Net-PCL library to your project






Step 4:

Now, remember the sqlite-uap (Visual Studio extension) installed earlier. It installs SQLite extensions that you need to reference by right-clicking on Project References and choosing "Add Reference..." and then finding the right reference under Windows Universal è Extensions.


Step 5:

Coding:

class LocalDatabase
    {
        public static void CreateDatabase()
        {
         var sqlpath = System.IO.Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "Contactdb.sqlite");
            using (SQLite.Net.SQLiteConnection conn = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), sqlpath))
            {
                conn.CreateTable();
            }
        }
    }







    public class Contact
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string Address { get; set; }
        public string Mobile { get; set; }
    }



No comments: