Re: MySQL/ASP.NET(C#) mysql_insert_id?
Posted by: Hauke Betz
Date: June 26, 2006 11:14PM

Hello,
After executing your Insert-Command (C#, Connection is stored in conDBConnection):

...
string strSQLSelect = "SELECT @@IDENTITY AS 'LastID'";
MySqlCommand dbcSelect = new MySqlCommand(strSQLSelect, conDBConnection);
MySqlDataReader dbrSelect = dbcSelect.ExecuteReader();

dbrSelect.Read();
int intCounter = Int32.Parse(dbrSelect.GetValue(0).ToString());

dbrSelect.Dispose();
conDBConnection.Close();

MessageBox.Show("Test: " + intCounter.ToString());

Greets,

Hauke




"SELECT @@IDENTITY AS 'LastID'"

Options: ReplyQuote


Subject
Written By
Posted
Re: MySQL/ASP.NET(C#) mysql_insert_id?
June 26, 2006 11:14PM


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.