zoukankan      html  css  js  c++  java
  • 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)

  • 相关阅读:
    Python 循环语句
    Python if、elif 、else语句 与 布尔运算
    Python 运算符
    Python 标识符
    Python 常用数据类型(整数,浮点数,复数,布尔型)
    Python 编辑器内容
    Python 语言介绍
    vscode 最新中文设置
    漫画数据库_基础和设计数据库
    linux配置服务器
  • 原文地址:https://www.cnblogs.com/yanyyx/p/1388609.html
Copyright © 2011-2022 走看看