database is not updated after submitchanges()
i know this question was asked before but i have this very weird beginner problem:
i want to update a list of actors by an id in which film they played (only one film)
DataClasses1DataContext db = new DataClasses1DataContext();
var old = from a in db.Actors
where a.id == 1
select a;
db.Log = Console.Out;
foreach (Actor act in old)
{
act.charname = "test";
act.lastname = "new name";
act.money = 1324;
}
db.S开发者_StackOverflow中文版ubmitChanges();
when i make a select query in my program after i executed this codesnippet the data is changed but when i look in the integrated sql express (server explorer) of my visual studio 2010 nothing happend and when i restart my programm the old vars are there not "test" and "new name" etc..
i dont know what i'm doing wrong i have a dbml file with this table, my table has a primary key and when i debug /breakpoint it on submitchanges() the variables in db changed also
is there something i missed? like a connectionstring or something like that?
thanks for your help!
Are you working with a database you created in SQL Express Server Explorer?
If so: then there is something else wrong.
If not: You're probably looking at the database YOU created. That database gets copied to your output directory (/nameofsolution/nameofproject/bin/debug/nameofdatabase.mdf
).
And your SQL gets executed on that database. You're probably looking at the wrong one ;)
精彩评论