I have working database and I want to use auto_increment for id's in my tables.
query.exec("create table przedmioty(id int auto_increment not null primary key, nazwa varchar(40), skrot varchar(10))");
query.exec("create table przedmioty(id int auto_increment not null primary key, nazwa varchar(40), skrot varchar(10))");
To copy to clipboard, switch view to plain text mode
creates table, but:
query.exec("insert into przedmioty(skrot, nazwa) values('Matematyka', 'mat')");
query.exec("insert into przedmioty(skrot, nazwa) values('Matematyka', 'mat')");
To copy to clipboard, switch view to plain text mode
throws QSqlError(19, "Unable to fetch row", "constraint failed") .
I want to mention that without "auto_increment" my program adds records.
What to do?
Bookmarks