关于更新数据库解决方法

关于更新数据库解决方法

关于更新数据库
try
{
    this.Validate();
    this.customersBindingSource.EndEdit();
    this.customersTableAdapter.Update(this.northwindDataSet.Customers);
    MessageBox.Show("Update successful");
}
catch (System.Exception ex)
{
    MessageBox.Show("Update failed");
}

以上代码为使用 TableAdapter 更新数据,如果想把它放在WCF服务的中间层里,供客户端进行调用,具体该如何写呢?
------解决方案--------------------
  把这句写成一个数据访问层的方法this.customersTableAdapter.Update(this.northwindDataSet.Customers);

然后中间层再写一个方法去调用上面这个方法就可以了