· 7 years ago · Sep 18, 2018, 11:26 AM
1Cannot create table SQLite Windows 8
2private void InitData()
3 {
4 ListBox1.Items.Clear();
5
6 Database db = new Database(Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "bppro.db"));
7
8 Statement stm;
9 stm = db.PrepareStatement("CREATE TABLE IF NOT EXISTS vitals (_id integer primary key autoincrement, creationdate text,weight text,pulse text,sys text,dia text");
10 stm.Execute();
11 stm.Dispose();
12
13 string temp = System.DateTime.Now.Ticks.ToString();
14
15 byte[] binaryData = new byte[100];
16 stm = db.PrepareStatement("INSERT INTO vitals (creationdate,weight,pulse) VALUES (?,?,?)");
17 stm.BindParamText(1, System.DateTime.Now.ToString());
18 stm.BindParamInt(2, 35);
19 stm.BindParamInt(3, 60);
20 stm.Execute();
21 stm.Dispose();
22
23 long insertedRowId = db.LastInsertRowId;
24
25 stm = db.PrepareStatement("SELECT * from vitals");
26 while (stm.GetNextRow())
27 {
28 string createdate=stm.GetTextAt(1);
29 string weight = stm.GetTextAt(2);
30 string pulse = stm.GetTextAt(3);
31 ListBox1.Items.Add(createdate.ToString()+" "+weight.ToString()+" "+pulse);
32 }
33 stm.Dispose();
34 }