How to get the next autoincrement id for a database table programmatically

See also: