Hellow there;

I'm trying to view data from a simple DB table to a QtableView.
I used the Sample Code supplied in the QSqlTableModel's Documentation page with a minor modification.
I have a STUDENT table with id pk and name
Qt Code:
  1. -- the DB engine is sqlite:
  2. create table student (id INTEGER PRIMARY KEY AUTOINCREMENT, name varchar(20) not null);
To copy to clipboard, switch view to plain text mode 
and i modified the code to be :
Qt Code:
  1. model = new QSqlTableModel;
  2. model->setTable("student"); //that's the table name
  3. model->setEditStrategy(QSqlTableModel::OnManualSubmit); // whatever edit strategy, it still not working
  4. model->select();
  5. model->setHeaderData(0, Qt::Horizontal, tr("id"));
  6. model->removeColumn(0); // don't show the ID; <<-- here is the PROBLEM
  7. model->setHeaderData(1, Qt::Horizontal, tr("name"));
  8.  
  9. ui->tableView->setModel(model);
  10. ui->tableView->show();
To copy to clipboard, switch view to plain text mode 
data is shown and everything is fine. But when I try to update a recoed ' the name field for a given record'; I get a debug message saying :
Qt Code:
  1. QSqlQuery::value: not positioned on a valid record
To copy to clipboard, switch view to plain text mode 
and the rows don't update
If I just commented the removeColumn() line; data updates when I modify them and everything works fine.
BUT I need to remove the ID column - i.e keep it hidden from users - ! it is the PRIMARY KEY and I cant just let users manipulate it

Is there a way to hide the ID column and still be able to update 'the other column values that are NOT id' ???

thanx alot in advance