我是 Windows Phone 编程的新手,正在尝试运行一个简单的应用程序。但是,我在调试时遇到了困难。
在创建数据库时,我想插入一些默认数据:
using (DODataContext db = new DODataContext(DBConnectionString))
{
if (db.DatabaseExists() == false)
{
// Create the local database.
db.CreateDatabase();
DateTime DateFields = new DateTime(2013, 1, 1, 0, 0, 0);
// Prepopulate the categories.
db.Languages.InsertOnSubmit(new DOLanguage { Code = "EN", Name = "English", LastUpdate = DateFields });
db.Languages.InsertOnSubmit(new DOLanguage { Code = "FR", Name = "French", LastUpdate = DateFields });
db.Languages.InsertOnSubmit(new DOLanguage { Code = "ES", Name = "Spanish", LastUpdate = DateFields });
db.MenuItems.InsertOnSubmit(new DOMenuItem { Id = 3, Title = "Test 3", LastUpdate = DateFields, Level = 1, Action = "article/1", CommonId = 1, Section = "", Icon = "", Published = true, _languageId = 1 });
// Save categories to the database.
db.SubmitChanges();
}
}
但是,在“db.MenuItems.InsertOnSubmit”上,应用程序崩溃,我得到以下控制台输出(db.Languages.InsertOnSubmit 工作正常):
线程 '' (0x18630716) 已退出,代码为 0 (0x0)。线程 '' (0x183809e2) 已退出,代码为 0 (0x0)。线程 '' (0x191d0b02) 已退出,代码为 0 (0x0)。
没有信息,我不知道出了什么问题。有人对如何调试此问题有任何建议吗?