Re: RecordChangeComplete and Primary Key constraint

From: Kevin Yu [MSFT] (v-kevy_at_online.microsoft.com)
Date: 09/30/04


Date: Thu, 30 Sep 2004 02:59:33 GMT

Hi Olivier,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that when you have inserted a record which
violates the unique constraint, the status of the field doesn't change. If
there is any misunderstanding, please feel free to let me know.

Yes, you're right. The status property will not change when invalid row is
inserted to a recordset.

As far as I know, this is by design. According to the MSDN document, this
property indicates the status of a field. Generally, it is changed when
fields are created or inserted to the table. Also, changes to the value of
a Field object in the Fields collection of either a Recordset are cached
until the object's Update method is called. At that point, if the change to
the Field's value caused an error, OLE DB raises the error
DB_E_ERRORSOCCURRED (2147749409). The Status property of any of the Field
objects in the Fields collection that caused the error will contain a value
from the FieldStatusEnum describing the cause of the problem.

For more information, please check the following links:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/
mdprostatusfield.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/
mdevtwillchangerecord.asp

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."



Relevant Pages

  • Re: Releasing Field References Early
    ... i don't agree that field object still exists because closing the ... recordset object without setting its reference to nothing and accessing ... the field reference causes the same error. ... closing, recordset drops reference counts of the fields in its fields ...
    (microsoft.public.scripting.vbscript)
  • Re: Releasing Field References Early
    ... strAuthor apparently loses its value once the Recordset is closed. ... reference to a Field object, not a string, as it appears to be. ... to use explicit code rather than use default properties. ...
    (microsoft.public.scripting.vbscript)
  • Re: RecordChangeComplete and Primary Key constraint
    ... But it seems that in my specific case the status property of the recordset ... The value is only adRecNew. ... > a Field object in the Fields collection of either a Recordset are cached ...
    (microsoft.public.data.ado)
  • Re: Script example in KB Q271728 wont work.
    ... Dim rs ... 'ADO recordset object. ... 'ADO field object. ... Set fld = rs.Fields ...
    (microsoft.public.access.dataaccess.pages)
  • data access page runtime error
    ... 'the recordset until it finds a match. ... dim rs 'ADO recordset object ... dim fld 'ADO field object ... set fld = rs.Fields ...
    (microsoft.public.access.gettingstarted)