Update affected more than 1 record

使用 ClientDataSet 对主从表进行操作。

在操作中Del主表,(在SQL中写存储过程,由ID字段删除子相应的子表),报 Update affected more than 1 record 错误,删除也提交不了。用了事务也报错,怪事也!

在网上找了半天,发现没有一个中文的有较答案。

不过还是找到了英文的。呵呵~!

主表与子表之间 关系 ,创建相应的关系,不报错了,删除也能提交了。呵呵~!

附上英文:

"Update affected more than 1 record" error

(Delphi 2007)
Am using a ClientDataSet to manage editing of a simple record:

EmployeeID (primary key)
FirstName (required)
LastName (required)
HireDate (required)
ExitDate (not required)
Nickname (not required)
Photo (image, not required)

Have one case where there are two records with the same employee
First/LastName but different keys and other values. Changing the value of
any field (e.g. nickname) in one of these records and calling ApplyUpdates
generates "Update affected more than 1 record". I seem to get this error no
matter what the Provider Flags are set to for the Provider and Client
DataSet (EmployeeID has pfInKey set). I don't understand because the
EmployeeID field should uniquely identify which record to change.

How we set the Provider Flags for the DataSet Provider and for the fields
doesn't seem to make any difference. Also, we've been following the same
format for all sorts of database tables previously and have not seen this
error before now.Can anyone give me a direction to go in? No luck Googling
this error and CodeGear's help is woeful.

Many thanks for your assistance.

Jeff  

 

Solved the problem:

Had a database trigger on the table that was not key specific. Updates to
the dataset where firing this trigger which caused the error.


"Bill Todd" <no@no.com> wrote in message
news:46fd9189$1@newsgroups.borland.com...
> Jeff W. wrote:
>
>> Provider and Client DataSet (EmployeeID has pfInKey set). I don't
>> understand because the EmployeeID field should uniquely identify
>> which record to change.
>
> You must set the ProviderFlags on the source dataset (the one in the
> DSP's DataSet property) not the CDS.
>
> --
> Bill Todd (TeamB)

posted on 2009-02-11 21:30  Yanyyx 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/yanyyx/archive/2009/02/11/1388609.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值