Massimo's idea would work, but the table would need to have "membership_id" 
set up as an identity field. If your existing structure requires you to 
manually fill in this value yourself, then you would have to do your inserts 
manually using executesql:

db.executesql("INSERT INTO member (membership_id, first_name) VALUES 
((SELECT MAX(membership_id) FROM member) + 1, 'bob')")

This may not be the exact SQL you would use, but it gets my point across. 
Also, you would not want to append the first_name value. You would want to 
use executesql() placeholders to sanitize the data to prevent SQL injection.

By doing the select in the same query as the insert, you can prevent 
duplicate membership_id's from being generated.

Reply via email to