Identify cannot be determined for newly inserted rows

Identify cannot be determined for newly inserted rows

Post by Rob Nicholso » Thu, 24 Aug 2000 04:00:00



Why does the following fragment generate the error "Identify cannot be
determined for newly inserted rows":

DB.rsOpenObjects.Open
With DB.rsOpenObjects
    .AddNew
    .Update
    !ObjectID = -5
    .Update
End With

It happens on !ObjectID = -5

What I'm trying to do is add a record, update it and then perform another
update.

Cheers, Rob.

 
 
 

Identify cannot be determined for newly inserted rows

Post by Andrew J. Kell » Thu, 24 Aug 2000 04:00:00


Rob,

    I don't understand what the !ObjectID = -5 is all about but I think I
know your problem.  I am willing to bet that the underlying table has an
identity column. When you add a new row thru ADO with the AddNew method it

So when you try and issue an update on a newly inserted record it doesn't
know the PK to use to find the proper row.

Andy


Quote:> Why does the following fragment generate the error "Identify cannot be
> determined for newly inserted rows":

> DB.rsOpenObjects.Open
> With DB.rsOpenObjects
>     .AddNew
>     .Update
>     !ObjectID = -5
>     .Update
> End With

> It happens on !ObjectID = -5

> What I'm trying to do is add a record, update it and then perform another
> update.

> Cheers, Rob.


 
 
 

Identify cannot be determined for newly inserted rows

Post by andy_h4.. » Fri, 25 Aug 2000 04:00:00


I recently had this problem and found the answer here:

http://www.kamath.com/tutorials/tut007_identity.asp



> Rob,

>     I don't understand what the !ObjectID = -5 is all about but I
think I
> know your problem.  I am willing to bet that the underlying table has
an
> identity column. When you add a new row thru ADO with the AddNew
method it

the RS.
> So when you try and issue an update on a newly inserted record it
doesn't
> know the PK to use to find the proper row.

> Andy



> > Why does the following fragment generate the error "Identify cannot
be
> > determined for newly inserted rows":

> > DB.rsOpenObjects.Open
> > With DB.rsOpenObjects
> >     .AddNew
> >     .Update
> >     !ObjectID = -5
> >     .Update
> > End With

> > It happens on !ObjectID = -5

> > What I'm trying to do is add a record, update it and then perform
another
> > update.

> > Cheers, Rob.

Sent via Deja.com http://www.deja.com/
Before you buy.
 
 
 

Identify cannot be determined for newly inserted rows

Post by Rob Nicholso » Fri, 25 Aug 2000 04:00:00


Quote:>     I don't understand what the !ObjectID = -5 is all about but I think I

That just happens to be another field in the record.

> know your problem.  I am willing to bet that the underlying table has an
> identity column. When you add a new row thru ADO with the AddNew method it

RS.
> So when you try and issue an update on a newly inserted record it doesn't
> know the PK to use to find the proper row.

Yes, it has an identity column called ID (which autoincrements). I think
you're right, it is something to do with this field. It's the second .Update
that fails. My take on this is that after the UPDATE on a newly added
record, ADO doesn't know where the record was actually added to the table.
In fact, you can fix it by doing this:

DB.rsOpenObjects.Open
With DB.rsOpenObjects
.AddNew
.Update
TempBookmark = .Bookmark
.Bookmark = TempBookmark
!ObjectID = -5
.Update
End With

Cheers, Rob.

 
 
 

1. Identity cannot be determined for newly inserted rows

Hi,

I'm trying to run some old code that was originally written in VJ++.  My
code is attempting to update a recordset and I'm receiveing an exception
whose message states, "Identity cannot be determined for newly inserted
rows".

This code used to work on another system, of course my present systen
has .net installed and lots of other new bits and pieces.
Any idea what might be causing this exception?  I've searched the MS
Knowledgebase and MSDN Libraries.

Thanks
Phil

2. Full-text query failure

3. Timeout Expired Error

4. Error - The provider is unable to determine identity for newly inserted rows (0x80040E1B)

5. SQL Transaction Rolling Back

6. Oracle To Ingres Gateway

7. The provider is unable to determine identity for newly inserted rows

8. Restricting FOR EACH ROW to newly inserted row

9. Determining newly inserted identity value in DB2 v6

10. Newbie, Getting the Primary Key of a newly inserted row

11. How to get newly inserted row?