我是新來使用LINQ與實體我有以下,我試圖運行更新。LINQ到實體更新記錄
OEEPumaDBEntities PumaOEEModel = new OEEPumaDBEntities();
Parameter1 parameter = new Parameter1();
parameter.ProductionWarning = int.Parse(txtProductionWarning.Text);
parameter.ProductionDistress = int.Parse(txtProductionDistress.Text);
parameter.ShiftStart = cmbShiftStart.Text;
try
{
PumaOEEModel.SaveChanges();
}
catch
{
throw new Exception("Could not save changes.");
}
當我運行代碼時,它調試正常,並沒有發現任何錯誤。但是當我檢查SQL數據庫時,它沒有用新數據更新記錄。我已經改變了代碼,並可以添加新的行,但由於某種原因,我不能更新記錄。任何人都可以看到有關上述代碼的任何問題和建議如何我可以改變這一點?
也有不錯的方法'查找()'如果實體上下文 –