0

Update

I've just found what's causing it but couldn't solve it :

When running the project, VS copies the SDF file to bin\Debug, therefore, any changes made to it, even if only refreshing the DB will cause it to be overwritten...


I've created a quick and dirty project to test SQL CE 4.0, designed a small table and added an Update button to save entered data. So far everything works, I close and reopen the application, data is loaded and shown in the DataGridView.

enter image description here

There is one issue however, whenever I make any changes in Server Explorer such as just refreshing the connection,

enter image description here

when I launch the application again, all the data I entered is gone.

enter image description here

Did I miss something ?

How I created the database :

  • From Data Sources I've added a new data source, created a new connection, created a new database, answered yes for copying it to my project and modifying the connection.

  • Then from Server Explorer I created a new table, added columns

  • Finally, I reconfigured my data source so it recreates the data set, data table and the adapter

aybe
  • 15,516
  • 9
  • 57
  • 105

1 Answers1

0

Here is a fix for it :

Do not copy it locally to the project folder, there won't be two versions with one overwriting the other.

aybe
  • 15,516
  • 9
  • 57
  • 105