+ Reply to Thread
Results 1 to 4 of 4

Thread: View with 3 column remove row work with 4 column dont work with 5 cant edit

  1. #1

    Default View with 3 column remove row work with 4 column dont work with 5 cant edit

    Hi
    Table Pracownicy
    Qt Code:
    1. | Pracownicy | CREATE TABLE `Pracownicy` (
    2. `IDPracownika` int(11) NOT NULL AUTO_INCREMENT,
    3. `IDStanowiska` int(11) DEFAULT NULL,
    4. `Imie` char(20) NOT NULL,
    5. `Nazwisko` char(20) NOT NULL,
    6. `DataUrodzenia` date DEFAULT NULL,
    7. `Ulica` char(20) DEFAULT NULL,
    8. `NrDomu` char(10) DEFAULT NULL,
    9. `KodPocztowy` char(5) DEFAULT NULL,
    10. `Miasto` char(20) DEFAULT NULL,
    11. `DataZatrudnienia` date DEFAULT NULL,
    12. `DataZwolnienia` date DEFAULT NULL,
    13. `Pensja` float DEFAULT NULL,
    14. PRIMARY KEY (`IDPracownika`),
    15. KEY `FK_R1` (`IDStanowiska`)
    16. ) ENGINE=MyISAM AUTO_INCREMENT=37 DEFAULT CHARSET=latin1
    To copy to clipboard, switch view to plain text mode 

    View
    Qt Code:
    1. CREATE VIEW V1 AS
    2. SELECT IDPracownika,Imie,Nazwisko
    3. FROM Pracownicy
    4.  
    5. CREATE VIEW V2 AS
    6. SELECT IDPracownika,Imie,Nazwisko,IDStanowiska
    7. FROM Pracownicy
    8.  
    9. CREATE VIEW V3 AS
    10. SELECT IDPracownika,Imie,Nazwisko,IDStanowiska,DataUrodzenia
    11. FROM Pracownicy
    To copy to clipboard, switch view to plain text mode 

    Qt Code
    Qt Code:
    1. Part 1) //Selecting Table
    2. Login to DB ....
    3.  
    4. model.setTable("V1");
    5. model.select();
    6.  
    7. QTableView table;
    8. table.setModel(&model);
    9. table.show();
    10.  
    11. Part 2) //Delete rows
    12. QModelIndexList t_SelectedRow = table.selectionModel()->selectedRows();
    13. foreach(QModelIndex i, t_SelectedRow)
    14. 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 ??

  2. #2

    Default Re: View with 3 column remove row work with 4 column dont work with 5 cant edit

    I have solutnion, i cant remove row if some column is empty (if all column in view have data then i can delete row).
    WHY ????

  3. #3

    Default Re: View with 3 column remove row work with 4 column dont work with 5 cant edit

    Somebody know, why if columns IDStanowiska or DataUrodzenia is emplt (have Value NULL) then cant delete this row ??
    Columns Imie and Nazwisko can by emplty, because they are NOT NULL and MySQL automatically add empty String .

    Somebody Know how delete row if in View exist column how have NULL value ??

  4. Default Re: View with 3 column remove row work with 4 column dont work with 5 cant edit

    online nich chat thienthien_bk
    Friv Group, collection of funny games like Friv

+ Reply to Thread

Similar Threads

  1. QWidget -> updateGeometry dont work.
    By patrik08 in forum Qt Programming
    Replies: 7
    Last Post: 22nd May 2013, 15:55
  2. keypressevent dont work when MainWindow is minimized
    By spitty_cash in forum Qt Programming
    Replies: 0
    Last Post: 17th October 2011, 16:13
  3. Dont work replot() after using zoom
    By ruzik in forum Qwt
    Replies: 2
    Last Post: 25th September 2011, 09:26
  4. Replies: 3
    Last Post: 5th May 2011, 14:03
  5. make QTableView work as a multi-column list view
    By wesley in forum Qt Programming
    Replies: 1
    Last Post: 11th March 2008, 14:43

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts