2011-08-24 60 views

回答

4

它應該會自動更新您的記錄。事情是這樣的:

Customer cust = new Customer(); 
cust.Company = "blah"; 
context.Customers.Add(cust); 
context.SubmitChanges(); 
int NewPk = cust.Pk; 
3

你叫後SubmitChanges()您可以訪問對象的id字段檢索ID。

相關問題