Chris Spurgeon wrote:
> 
> I'm using DBI:ODBC to talk with a Microsoft Acces database and things are
> going along swimmingly, but I have this one issue...
> 
> I can perform an INSERT statement successfully.  Immediately after I do the
> INSERT, this line...
> 
>      my $rowcount = $sth->rows;
> 
> ....returns a value of 1, indicating a successful operation.  But I was also
> hoping that this line...
> 
>     my @resultsarray = $sth->fetchrow_array;
> 
> .... would return the row that I just inserted, or at least the primary key
> of the new row (an autoincremented number).  But it doesn't of course, the
> @resultsarray is empty.  So my question is after I do an insert how can I
> immediately get ahold of the entry I just made?  Immediately doing a SELECT
> right after the INSERT seems terribly inelegant.

Try doing a 
        select @@identity

right after the insert (on the same connection).

Michael

Reply via email to