Hi All,

i am creating a Desktop application using Microsoft Visual Studio .NET 2008..
i am using .sdf file as my database...
my problem is that when i am making changes to my records (add new, deleted, updated) then the changes reflects only till my application is running when i restart the application then i am not getting my changes...

I am using the default connection string

string conString = Properties.Settings.Default.DataConnectionString;
 SqlCeConnection con = new SqlCeConnection(conString);

the value given by the visual studio for this database is

Data Source=|DataDirectory|\Data.sdf

i dont know what mistake i am doing ,, but all the queries are executing....


Running in debug mode?

yes i am.. what that has to do with this.. can you explain.. i don't know that..

thanks for reply

When you run in debug mode the system makes a copy of your sdf file to work with, so that it doesn't ruin the original.

yes i got it.. i have changed the database copy as 'Do not Copy' and manually placed a copy of my database in the bin/debug folder .. now for the moment it is working fine.. is this the right way..


It is a way that will work. The system uses a copy when debugging so you can recreate problems that occur (if it made changes, then you'd have to constantly restore the old database to test again).