Re: Key column information insufficient....ERROR

From: Stephen Howe (stephenPOINThoweATtns-globalPOINTcom)
Date: 12/30/04


Date: Thu, 30 Dec 2004 13:04:42 -0000


> While updating a recordset pulled from an access table through ADO, I am
> getting this error:
>
> "Key column information is insufficient... affect multiple records...."
>
> and multiple records get updated with same data.
>
> MSDN is at no help...Any suggestion?

Make sure you SELECT all fields that make up your PK from your table in your
recordset even if you don't use that field. The Recordset when updating
_HAS_ to be able to find the row to update and it uses the PK to do just
that. If you select only some of the fields in your Recordset that make up
the PK, ADO has no way of knowing which row to update, hence your message.

e.g.

If your PK consists of field1,field2 on a table and there is also field
3,field5 then doing a recordset based on

SELECT field1,field3 FROM table1

and you change field3

is not updateable because field2 is absent. It has to be

SELECT field1,field2,field3 FROM table1

(Note: There are other ways of helping ADO update a recordset but they are
more unusual)

Stephen Howe



Relevant Pages

  • Re: Is ADO Dead (3)?
    ... The Design of ADO ... ADO uses a single object, the Recordset, as a common representation for ... a forward-only stream of results from a database, ... where data is updated at the data source or cached locally as with the ...
    (comp.databases.ms-access)
  • Re: Is ADO Dead (3)?
    ... The Design of ADO ... ADO uses a single object, the Recordset, as a common representation for ... a forward-only stream of results from a database, ... where data is updated at the data source or cached locally as with the ...
    (comp.databases.ms-access)
  • Re: Is ADO Dead (3)?
    ... The Design of ADO ... ADO uses a single object, the Recordset, as a common representation for ... a forward-only stream of results from a database, ... where data is updated at the data source or cached locally as with the ...
    (comp.databases.ms-access)
  • Re: Is ADO Dead (3)?
    ... The Design of ADO ... ADO uses a single object, the Recordset, as a common representation for ... a forward-only stream of results from a database, ... where data is updated at the data source or cached locally as with the ...
    (comp.databases.ms-access)
  • Re: DAO to ADO Recordset Options
    ... DAO was really fast when dealing with Access data (faster than ADO) but was ... Recordset. ... For client-sided cursors, there is only Static cursor type regardless as ... determines how often data is fetched from the server. ...
    (microsoft.public.data.ado)