Update a row in a QSqlTableModel
-
I want to use the updateRowInTable() method to update a row in a QSqlTableModel and so the database table.
Knowing the method is virtual protected, how to use it?! is like this?@tableModel->updateRowInTable(givenRow, myRecord);@
-
Please read the "documentation":http://developer.qt.nokia.com/doc/qt-4.7/qsqltablemodel.html.
bq. Updates the given row in the currently active database table with the specified values. Returns true if successful; otherwise returns false.
This is a low-level method that operates directly on the database and should not be called directly. Use setData() to update values. The model will decide depending on its edit strategy when to modify the database. -
it generates an error that tell me that the method is protected
-
thats because you can't use a "protected":http://msdn.microsoft.com/en-us/library/e761de5s.aspx method outside of its related class.
-
-
[quote author="freecamellia" date="1323943430"]Where are @Volker and @Andre?[/quote]
Here, but neither of us is your personal Qt consultant (at least, not that I know of) :-)Edit:
On topic then: I think you should heed the warning in the documentation of that method, that it should not be called directly and that you should use setData(). If you want to do it in another way, fine, but don't expect help on doing that unless you have a very, very good reason for it. And no, "I think this is easier" does not qualify. -
I am a computer science's engineering student, I have been learning Qt for the last 2-3 month so I am a beginner in Qt. My purpose in this moment is just to learn, so I make the most of your forum.