2

我正在尝试获取存储在本地数据库中的数据。我正在使用这样的东西:

// Connect to the database and instantiate data context.
tablesDB = new TablesDataContext(TablesDataContext.DBConnectionString);    

// Define the query to gather all of the items.
var CategoriesTablesInDB = from CategoryItem todo in tablesDB.CategoriesTable
                                           select todo;

// Execute the query and place the results into a collection.
CategoriesTable = new ObservableCollection<CategoryItem>(CategoriesTablesInDB);

但是我CategoriesTable在这样做之后有 count = 0 ,并且CategoriesTablesInDB里面有它的 sql 查询。我是 Windows Phone 新手,如果这样做是正确的方法,我不会。是我的查询有问题,还是我做得不对?

4

1 回答 1

0

Sadly, can't help you with exact answer. But if you are just getting started you could also try store data in SQLite instead of native local database. It helps you build cross-platform applications in future and has a wide community support.

于 2013-01-15T13:07:03.917 回答