Hi
Table Pracownicy
| Pracownicy | CREATE TABLE `Pracownicy` (
`IDPracownika` int(11) NOT NULL AUTO_INCREMENT,
`IDStanowiska` int(11) DEFAULT NULL,
`Imie` char(20) NOT NULL,
`Nazwisko` char(20) NOT NULL,
`DataUrodzenia` date DEFAULT NULL,
`Ulica` char(20) DEFAULT NULL,
`NrDomu` char(10) DEFAULT NULL,
`KodPocztowy` char(5) DEFAULT NULL,
`Miasto` char(20) DEFAULT NULL,
`DataZatrudnienia` date DEFAULT NULL,
`DataZwolnienia` date DEFAULT NULL,
`Pensja` float DEFAULT NULL,
PRIMARY KEY (`IDPracownika`),
KEY `FK_R1` (`IDStanowiska`)
) ENGINE=MyISAM AUTO_INCREMENT=37 DEFAULT CHARSET=latin1
| Pracownicy | CREATE TABLE `Pracownicy` (
`IDPracownika` int(11) NOT NULL AUTO_INCREMENT,
`IDStanowiska` int(11) DEFAULT NULL,
`Imie` char(20) NOT NULL,
`Nazwisko` char(20) NOT NULL,
`DataUrodzenia` date DEFAULT NULL,
`Ulica` char(20) DEFAULT NULL,
`NrDomu` char(10) DEFAULT NULL,
`KodPocztowy` char(5) DEFAULT NULL,
`Miasto` char(20) DEFAULT NULL,
`DataZatrudnienia` date DEFAULT NULL,
`DataZwolnienia` date DEFAULT NULL,
`Pensja` float DEFAULT NULL,
PRIMARY KEY (`IDPracownika`),
KEY `FK_R1` (`IDStanowiska`)
) ENGINE=MyISAM AUTO_INCREMENT=37 DEFAULT CHARSET=latin1
To copy to clipboard, switch view to plain text mode
View
CREATE VIEW V1 AS
SELECT IDPracownika,Imie,Nazwisko
FROM Pracownicy
CREATE VIEW V2 AS
SELECT IDPracownika,Imie,Nazwisko,IDStanowiska
FROM Pracownicy
CREATE VIEW V3 AS
SELECT IDPracownika,Imie,Nazwisko,IDStanowiska,DataUrodzenia
FROM Pracownicy
CREATE VIEW V1 AS
SELECT IDPracownika,Imie,Nazwisko
FROM Pracownicy
CREATE VIEW V2 AS
SELECT IDPracownika,Imie,Nazwisko,IDStanowiska
FROM Pracownicy
CREATE VIEW V3 AS
SELECT IDPracownika,Imie,Nazwisko,IDStanowiska,DataUrodzenia
FROM Pracownicy
To copy to clipboard, switch view to plain text mode
Qt Code
Part 1) //Selecting Table
Login to DB ....
model.setTable("V1");
model.select();
table.setModel(&model);
table.show();
Part 2) //Delete rows
QModelIndexList t_SelectedRow = table.selectionModel()->selectedRows();
model.removeRow(i.row());
Part 1) //Selecting Table
Login to DB ....
QSqlRelationalTableModel model;
model.setTable("V1");
model.select();
QTableView table;
table.setModel(&model);
table.show();
Part 2) //Delete rows
QModelIndexList t_SelectedRow = table.selectionModel()->selectedRows();
foreach(QModelIndex i, t_SelectedRow)
model.removeRow(i.row());
To copy to clipboard, switch view to plain text mode
So, why delete work on V1 but on V2 dont work ??
In V1 and V2 edit rows work but in V3 delete row and edit dont work
Why ??
Bookmarks