当前位置: 代码迷 >> Web Service >> 关于更新数据库解决方法
  详细解决方案

关于更新数据库解决方法

热度:209   发布时间:2016-05-02 02:39:03.0
关于更新数据库
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);

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