2013-09-30 60 views
2

我已經創建了Windows Phone 7的數據庫和它的作品對我很。檢查數據庫的路徑。在Windows Phone的數據源7

重建它說,

數據庫文件無法找到該應用程序後。檢查數據庫的路徑。 [數據源= \應用\數據\ 6157CB94-31D3-4E6F-BFC3-78BE1549C10A \數據\ IsolatedStore \ amit.sdf]

我爲分貝串碼是

` private const string Con_String = @"isostore:/amit.sdf";` 

如何解決這個請給我任何建議來解決這個問題

回答

3

你檢查了這個樣本How to create a basic local database app for Windows Phone

他們使用此路徑爲創建數據庫

//Specify the connection string as a static, used in main page and app.xaml. 
public static string DBConnectionString = "Data Source=isostore:/ToDo.sdf"; 

,也不要忘記檢查,如果存在分貝

//Create the database if it does not exist. 
using (ToDoDataContext db = new ToDoDataContext(ToDoDataContext.DBConnectionString)) 
{ 
    if (db.DatabaseExists() == false) 
    { 
     //Create the database 
     db.CreateDatabase(); 
    } 
} 
+0

感謝我忘了添加創建數據庫,如果它不存在, ,現在它對我很好,謝謝 – John