I cannot seem to return text from a record in a table..
In this function - "bg_word" is a text string in a record in a table.
I can return an integer if I make the necessary changes, but not text...
What am I missing?
(Yes, there is warnings of not using the two bools - not important at this point)
Qt Code:
void Dialog::translate() { QString bg; db.setHostName(""); db.setDatabaseName("enbg_database"); db.setUserName(""); db.setPassword(""); bool ok = db.open(); QSqlQuery query; bool queryok = query.exec("select bg_word from enbg_table where id=1"); while(query.next()) { bg = query.value(0).toString(); } translated_bg->setText(bg); }To copy to clipboard, switch view to plain text mode
Bookmarks