cant get last insert id no matter what i try. someone help please!!!!
Posted by: david
Date: August 24, 2006 09:34PM

does anyone have any idea why this gives 0?
cmd2.CommandText = "select LAST_INSERT_ID() as lastins";
newfileid = cmd2.ExecuteScalar().ToString();

newfileid at this point is "0", where it should be "70".
if i execute the query directly against mysql the result given back is "70"

i also tried this:
cmd2.CommandText = "SELECT @@IDENTITY AS 'LastID'";
and again the result is zero

i then tried this
cmd2.CommandText = "select count(*) FROM content";

and the result was correct (for that query)

does this mean there is a problem getting the last insert id???
am i doing something wrong?


===
the versions i am using are
mysql-5.0.24-win32

Connector/NET
MySqlCommand
MySqlConnection
MySqlDataAdapter
v1.0.7.30072



Edited 1 time(s). Last edit at 08/24/2006 09:40PM by david .

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.