List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:November 27 2000 4:17pm
Subject:Re: SELECT LAST_INSERT_ID() Fails using ADO
View as plain text  
In the last episode (Nov 26), Jose Albert (personal) said:
> Hi everybody!
> Im writing a client in vbasic that insert data on a mysql
> 3.23.27-beta database using myodbc on Win2k, and after
> insert a new record when I check for: Recordset.Open "SELECT
> LAST_INSERT_ID();", conection it gets empty. Im being using DAO with
> perl writing asp over windows NT without any problems.

This might be the same problem I've seen in MS Access when I do
something similar.  I think the mysql "auto_is_null" option has a bug
where it zeroes the last_insert_id value.  You insert a record, ODBC
does a "SELECT WHERE key IS NULL" behind your back, mysql zeroes
last_insert_id, you try to "SELECT last_insert_id()", and it returns

My fix has been to edit and remove the AUTO_IS_NULL option
from thd_startup_options, but a better fix would probably be to remove
line 3047 from (the "thd->insert_id(0);" line).

	Dan Nelson
SELECT LAST_INSERT_ID() Fails using ADOpersonal)27 Nov
  • Re: SELECT LAST_INSERT_ID() Fails using ADODan Nelson27 Nov
    • RE: SELECT LAST_INSERT_ID() Fails using ADOSales-DataTrak Business Solutions27 Nov
      • Re: SELECT LAST_INSERT_ID() Fails using ADOCarsten Gehling28 Nov