I have a Winforms application and I added a local database (SQL Server Compact Edition 3.5) to the project.
I added tables and so on.
Also, I added an Entity Data Model to the project, selected Generate from database
, then selected the connection string that visual studio offered:
Data Source=|DataDirectory|\SBDATA.sdf
Then, I checked all tables from the database and built my project. So far so good.
In my form I have written this code for AddFolderButton_Click
:
using (SBDATAEntities de = new SBDATAEntities())
{
Folders f = new Folders();
f.Description = folderDescription;
f.Path = folderPath;
f.Mask = folderMask;
de.AddToFolders(f);
de.AcceptAllChanges();
de.SaveChanges();
}
Note that there are more columns in the table but they are accepting null so I think It doesn't matter.
I am getting NO ERRORS, no crash. But when I click on the table in the Server Explorer
and choose Show Table Data
, I get no records.
Can please someone tell me what am I doing wrong ?