读书人

关于更新数据库解决办法

发布时间: 2012-05-12 15:39:31 作者: rapoo

关于更新数据库

C# code
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);

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

读书人网 >Web Service

热点推荐