使用SubSonicRepository更新方法时出错 - SubSonic 3.4

时间:2010-06-25 18:29:40

标签: c# subsonic3 repository

以下是我用来更新客户表的示例代码。

public void UpdateCustomer(){

   SAPDB db = new SAPDB();
   SubSonicRepository<Customer> ssr = new SubSonicRepository<Customer>(db);
   Customer customer = new Customer();
   customer.ID = 5;
   customer.CustomerName = "John";
   int val = ssr.Update(customer);

}

请让我知道我跟随的方式是对还是错?或者在SubSonic 3中是错误的吗?

1 个答案:

答案 0 :(得分:0)

你的架构是什么?

您可能希望通过

加载客户的现有数据
Customer c= new Customer(5);
customer.CustomerName = "John";
customer.Save();