This looks like the same problem I have with MS Access.  It seems MS Access 
uses the SELECT id FROM table_name WHERE is IS NULL, and this syntax clears 
the last insert ID field.  My solution is here:

--- One Line URL, might wrap ---
http://groups.google.com/groups?hl=en&safe=off&threadm=9ehc8i%2428sa%241%40FreeBSD.csie.NCTU.edu.tw&rnum=5&prev=/groups%3Fq%3Dodbc%2Blast_insert_id%2Baccess%26hl%3Den%26lr%3D%26safe%3Doff%26btnG%3DGoogle%2BSearch%26site%3Dgroup
--- One Line URL, might wrap ---

On Tuesday 12 November 2002 12:04, Alan McDonald wrote:
> The .Neta Adapter.. does it make a persistent connection?
> If the connection drops between the first insert and the call to select,
> then the return would be zero
>
> Alan
>
> > -----Original Message-----
> > From: Cain O'Sullivan [mailto:cos@;iinet.net.au]
> > Sent: Wednesday, 13 November 2002 16:13
> > To: [EMAIL PROTECTED]
> > Subject: last_insert_id()
> >
> >
> > Hi,
> >
> > I am using C# with ODBC.Net to communicate with MySQL.  I want to
> > determine
> > the last ID of an auto_increment field in the database.  When I manually
> > perform the insert using the MySQL command window I can then
> > follow up with
> > "select last_insert_id()" and I get the correct value, however, when
> > using ODBC to perform the insert (via a .Net DataAdapter) the
> > last_insert_id() returns 0.
> >
> > Can anyone provide some insight into this?
> >
> > Best Regards,
> >
> > Cain O'Sullivan
> > [EMAIL PROTECTED]
> >
> >
> > ---------------------------------------------------------------------
> > Before posting, please check:
> >    http://www.mysql.com/manual.php   (the manual)
> >    http://lists.mysql.com/           (the list archive)
> >
> > To request this thread, e-mail <[EMAIL PROTECTED]>
> > To unsubscribe, e-mail
> > <[EMAIL PROTECTED]>
> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-- 
Joshua Kugler, Information Services Director
Associated Students of the University of Alaska Fairbanks
[EMAIL PROTECTED], 907-474-7601

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to