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);
 con.Open();

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....

Thanks
vince

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
vince

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..

thanks
vince

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).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.