MySQL新增完後
會將資料留在DB Connection
PHP--
PHP有提供相關函數
執行mysql_insert_id(),即最後新增的id
.Net-- (http://forums.mysql.com/read.php?38,98672,98868#msg-98868)
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());
沒有留言:
張貼留言