« 於: 四月 12, 2009, 09:38:37 pm »
php
mysql_insert_id --- 取得先前INSERT操作的id
語法 : int mysql_insert_id ([int link_identifier])
說明 :
mysql_insert_id( )傳回AUTO_INCREMENTED欄位所產生的id,它將使用給予的 link_identifier傳回最後執行INSERT查詢的ID,如果沒有指定 link_identifier則假定是最後所開啟的連結。
function _insertid()
{
return mysql_insert_id($this->_connectionID);
}
string strSQLSelect = "SELECT @@IDENTITY AS next_id";
MySqlCommand dbcSelect = new MySqlCommand(strSQLSelect, conDBConnection);
MySqlDataReader dbrSelect = dbcSelect.ExecuteReader();
dbrSelect.Read();
int intCounter = _r.GetInt32("next_id");
dbrSelect.Dispose();
conDBConnection.Close();