I'm carrying out a project on Visual Studio. I'm utilizing a local database (empty sql server compact edition). I selected Dataset and produced my table (Images). It features a primary autoincrement id column, as well as an nvarchar ImagePath column. I wish to place data inside it here is my code.

SqlCeConnection con = new SqlCeConnection();
con.ConnectionString = yeniApplicationDatabase.Properties.Settings.Default.DatabaseEdaConnectionString;
con.Open();
using (SqlCeCommand com = new SqlCeCommand("INSERT INTO Images (ImagePath) VALUES ('book')", con))
{
  com.ExecuteNonQuery();
}

I'm not sure why but that one does not give any error, the syntax(SQL) is okay. However, after i look into the table data, it's still null. Here's the one thing

Within the same run,
I execute that code, then I execute a different one that is choose * from images...
It shows 'book'. But nonetheless, the table information is empty, so when I rerun it without placing, only choosing from Images, it's gone again. I truly do not understand what's going on. Why can't I put anything during my database?

I additionally added disadvantage.Close() however it still does not work.

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 bond should complete the place.

EDIT: update around the solution

Which database file(.sdf) are you currently viewing to check on if the data continues to be placed. look into the content from the test table within the .sdf within the binDebug folder. In my opinion that the information is placed correctly within the database file available in binDebug folder.

Just found an identical question on stack overflow: Why can't I insert a record into my SQL Compact 3.5 database? and that i firmly think that your condition is the same. you're checking the incorrect database file.

I don't use Eclipse, but something you have to be careful for in Visual Studio when debugging local databases may be the Copy file property for that database file in Solution Explorer.

Automatically this rentals are "Copy", meaning a duplicate from the database is make the bindebug folder of the project and also the connection string would be to the copy. Should you alter the copy, your original file isn't transformed and also the changes are thrown away whenever your debug session exits.

Find out if your IDE copies the database and inspect the bond string. Also how's it going "checking the information table"? Are you currently utilizing the same connection string? Are you currently carrying this out following the debug session finishes?