I created a service-based database (.mdf
file) in Visual Studio 2013 and then I wanted to use Entity Framework model designed from database. Select methods work fine but when I'm trying to do some inserts - they do not work, I'm not even getting errors.
Code:
Database1Entities data = new Database1Entities();user player = new user();
player.Nick = "halo halo";
data.user.Add(player);
data.SaveChanges();
and table definition
I will be grateful for any help, thanks.
Feel free to ask for more informations if needed
Right after saving the data, query the database:
using (Database1Entities dbe = new Database1Entities())
{
var query = from usr in dbe.user select usr;
}
and check the contents of query
.
if the data you just inserted is there, then your MDF file is getting over-written in your compile/execute cycle. In visual studio mark the MDF file as "Do not copy" in the properties window.