Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
アイテムを挿入するだけの主キーIDを取得したい。PHPにはmysql_insert_id()があります。私はC#で書きます
データベースを直接クエリする必要があります。
SELECT last_insert_id() FROM mytable;
つまり、ODBCで言う
object lastID = new OdbcCommand("SELECT last_insert_id() FROM mytable", _connection).ExecuteScalar();
cmdがコマンドオブジェクトの場合は、次を試してください。
cmd.LastInsertId;