I have WinForms application am building and am using SQL Server Compact Edition 3.5.
Whenever I run the WinForms application and I have a query editor open in Visual Studio afterwards, any update query I run does not reflect in the application. If I run Select query to view the updated records, I could see from the query result that the data has changed but does not reflect in the application.
If I close the application and run it again the updates reflects in the application.
Is this normal? What is the best explanation for this?
UPDATE
from C#
string sqlceConnString = @"Data Source=|DataDirectory|\medicstores.sdf";
from new Query Connection window in Visual Studio
C:\Users\user12345\...\Visual Studio 2010\Projects\StockPro\StockProFormUI\medicstores.sdf
Update
I think this may be due to the application duplicating the database file copying it to \StockPro\StockProFormUI\bin\Debug\medicstores.sdf instead of using \StockPro\StockProFormUI\medicstores.sdf.
I think |DataDirectory| was resolved to \StockPro\StockProFormUI\bin\Debug\medicstores.sdf by the application which makes it a new copy from the physical file in \StockPro\StockProFormUI\medicstores.sdf and thus they are not the same
Check you Connection string first.
Disconnect your SQL CE database on your server explorer.
I also had that problem before.
You need to get where is the exact location of your sqlce database and and then change your connection string.
Test it first to place you sqlce on your drive c:\ and add Persist Security Info=False; on the end. and use the exact database file path.
You can use SQL CE Tool to view your SQLCE database instead of using visual studio.
SQL Server CE Query Tool – Code Porject
Regards