Mango adds support for SQL CE databases directly into the phone. Very convenient to store its data, it is sometimes a bit difficult to debug. Indeed it is sometimes useful to view or modify data from the database
The database is stored in isolated storage of your application, as a file ‘sdf’, the location and the name of the file is specified in your class inherits from DataContext.
I developed a week ago an add-in for Visual Studio to view and modify the contents of the isolated storage, so we can use it to retrieve the database file and modify it.
To setup the add-in, read this article
View the content of the database
After importing data using the add-in, just to indicate to Visual Studio where is your database.
This operation must be done only one time, Visual Studio will save the location of the database.
Just click on the menu: Tools> connect to the database from Visual Studio.
Now select “Microsoft SQL Server Compact 3.5” if is not already the case and enter the database path to your ‘.sdf’ file (if you have forgotten the path, it is displayed in the add-inIsolated Storage Tool).
After that, the database will appear in the Server Explorer to your Visual Studio.
View the content of a table
To view the contents of a table just right click on a table and select ‘show data table’
The table data will be displayed directly in the editor.
Alter table data
If you want to alter data or insert/delete data / table , do it directly in visual studio, remember only to export the new database to the phone or the emulator by clicking the export button of the add-in ‘Isolated Storage Tool ‘.
Your database has been updated, now restart the application if needed.