I am doing a project on Visual Studio. I am using a local database (empty sql server compact edition). I chose Dataset and created my table (Images). It has a primary autoin
SqlCeConnection con = new SqlCeConnection();
con.ConnectionString = yeniApplicationDatabase.Properties.Settings.Default.DatabaseEdaConnectionString;
con.Open();
SqlCeCommand com = new SqlCeCommand("INSERT INTO Images (ImagePath) VALUES ('book')", con);
com.ExecuteNonQuery();
com.Dispose();
con.Close();
Closing the connection should complete the insert.
EDIT: update on the solution
Which database file(.sdf) are you viewing to check whether the data has been inserted. check the content of the test table in the .sdf in the bin\Debug folder. I believe that your data is inserted properly in the database file which exist in bin\Debug folder.
Just found a similar question on stack overflow: Why can't I insert a record into my SQL Compact 3.5 database? and I firmly believe that your problem is exactly the same. you are checking the wrong database file.