[PyQt] QSql lastError() must be called BEFORE exec_() ??
Mario Daniel Carugno
carugnom at gmail.com
Sat Sep 5 12:12:28 BST 2009
Thanks for replies. First i'd like to make sure if that''s the normal
behavior or not. Can you confirm please ?
** To David **
> Here you get the error string after execution!
Sorry, the order of the lines is:
errorstr = str(query.lastError().text())
But the problem is there.
> Aren't you calling the QSqlDatabase's query method here?
Yes, I've tried with the QSqlDatabase object too, but it's the same.
** To Scott **
> I only use query.prepare() on rare occasions when I need to use addBindValue() to achieve automagic character escaping
That's the way i've started, but the data comes from user input, and I
don't know when it will need to be escaped, so i must use addBind
More information about the PyQt