0
我不能使用SQLite Metro和Windows 8創建表「IF NOT EXISTS」。如果我將「db」複製到application.local文件夾,我可以添加,編輯刪除記錄。它會創建數據庫,但沒有創建表。我用外部工具檢查了我的DDL,看起來是正確的。
下面是我的代碼:無法創建表SQLite Windows 8
private void InitData()
{
ListBox1.Items.Clear();
Database db = new Database(Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "bppro.db"));
Statement stm;
stm = db.PrepareStatement("CREATE TABLE IF NOT EXISTS vitals (_id integer primary key autoincrement, creationdate text,weight text,pulse text,sys text,dia text");
stm.Execute();
stm.Dispose();
string temp = System.DateTime.Now.Ticks.ToString();
byte[] binaryData = new byte[100];
stm = db.PrepareStatement("INSERT INTO vitals (creationdate,weight,pulse) VALUES (?,?,?)");
stm.BindParamText(1, System.DateTime.Now.ToString());
stm.BindParamInt(2, 35);
stm.BindParamInt(3, 60);
stm.Execute();
stm.Dispose();
long insertedRowId = db.LastInsertRowId;
stm = db.PrepareStatement("SELECT * from vitals");
while (stm.GetNextRow())
{
string createdate=stm.GetTextAt(1);
string weight = stm.GetTextAt(2);
string pulse = stm.GetTextAt(3);
ListBox1.Items.Add(createdate.ToString()+" "+weight.ToString()+" "+pulse);
}
stm.Dispose();
}
感謝,感謝任何幫助或指針。
所有你需要做的就是接受解答你的一些存在的問題:) –