//I have made a database with two tables.

CREATE TABLE member (\
id INTEGER PRIMARY KEY,\
name VARCHAR(40) NOT NULL,\
gender VARCHAR(40) NOT NULL,\
dob VARCHAR(40) NOT NULL,\
personalprivacy VARCHAR(40) NOT NULL)

CREATE TABLE persinfo (\
id INTEGER PRIMARY KEY,\
status VARCHAR(40) NULL,\
spouse VARCHAR(40) NULL,\
children VARCHAR(40) NULL,\
siblings VARCHAR(40) NULL,\
parents VARCHAR(40) NULL,\
nameid INTEGER NOT NULL,\
FOREIGN KEY(nameid) REFERENCES member(id)

It works fine. I just want to know if there is a way to generate id's with an auto-increment keyword or by any other means. I have made the first table generate id numbers by using this function.

int generateId(const QString &table)
{
QSqlQuery query;
query.exec("SELECT MAX(id) FROM " + table);
int id = 0;

if (query.next())
id = query.value(0).toInt() + 1;

return id;
}

Like I said it works fine, but it doesn't generate any id's for the persinfo table.

If anyone can help me please?