rc =sqlite3_prepare( Db, qry_getnewid, -1, &stmt, NULL); if( SQLITE_OK !=rc) diediedie( "..."); rc =sqlite3_step( stmt); if( SQLITE_ROW !=rc) { sqlite3_finalize( stmt); diediedie( "..."); } ... a->id =sqlite3_column_int( stmt, 0); ... sqlite3_finalize( stmt);