string path; SQLite.Net.SQLiteConnection conn; public MainPage(){ this.InitializeComponent(); path = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "db.sqlite"); conn = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), path); conn.CreateTable<Customer>(); } private void Retrieve_Click(object sender, RoutedEventArgs e) { var query = conn.Table<Customer>(); string id = ""; string name = ""; string age = ""; foreach (var message in query) { id = id + " " + message.Id; name = name + " " + message.Name; age = age + " " + message.Age; } textBlock2.Text = "ID: " + id + "\nName: " + name + "\nAge: " + age; } private void Add_Click(object sender, RoutedEventArgs e){ var s = conn.Insert(new Customer(){ Name = textBox.Text, Age = textBox1.Text }); } public class Customer { [PrimaryKey, AutoIncrement] public int Id { get; set; } public string Name { get; set; } public string Age { get; set; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)