即時通訊使用亞音速3.0.0.3 activerecord和一切都很好,我得到沒有錯誤,但當我更新數據庫,它似乎從來沒有真的發生,任何人都可以發現我失蹤的任何東西這裏?! TAsubsonic 3.0.0.3 doesent似乎更新數據庫
代碼:
var myquote = createNewQuote();
var gross = 36.00;
myquote.totalcost = gross; // set the new value in my model
UpdateModel(myquote); // update the model, something to do with dirty columns??
if(ModelState.IsValid) // check to make sure i have no errors in my model after changing it
myquote.Update(); // command that is supposed to update the database????
我已經把一個破發點上的UpdateModel,看着模型和價值是作爲導演,我沒有得到任何錯誤的ModelState有效過,模型,但是當我查看數據庫的總成本實際上沒有改變該記錄????
我也嘗試過.Save()但是這也似乎沒有改變什麼?????
感到有點疑惑
看來,即使我有一個newquote監守我創造了它,然後我要選擇什麼,我已經有了,然後把我的新的值,然後保存!!!!!離奇的做事方式????? (ModelState.IsValid) var newQuote = new_online_quote.SingleOrDefault(x => x.quoteid == myquote.quoteid);如果(ModelState.IsValid) var newQuote = new_online_quote.SingleOrDefault(x => x.quoteid == myquote.quoteid); newQuote.totalcost = gross; newQuote.Save(); } – davethecoder 2009-09-10 14:16:14