Re: cant get last insert id no matter what i try. someone help please!!!!
Posted by: david
Date: August 26, 2006 07:32AM

you are correct. i must have been calling last_insert_id() in a new connection (not in the same connection doing the insert). my apologies.
however, there is still an unsigned INT bug as follows:

a stored procedure that returns last_insert_id() as UInt64, returns System.Byte[] rather than the value. for example:

cmd.Parameters.Add("?newfileid", MySqlDbType.UInt64);
cmd.Parameters["?newfileid"].Direction = ParameterDirection.Output;

cmd.ExecuteNonQuery();
newfileid = cmd.Parameters["?newfileid"].Value.ToString();

this gives newfileid = "System.Byte[]"

whereas, if i just change
cmd.Parameters.Add("?newfileid", MySqlDbType.UInt64);
to
cmd.Parameters.Add("?newfileid", MySqlDbType.Int64);

newfileid is "98"
(although the underlying table field remains unsigned int 64).

the same goes for Int32.

===
also see my post
http://forums.mysql.com/read.php?38,112383,112383#msg-112383



Edited 1 time(s). Last edit at 08/26/2006 07:34AM 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.