M. Bashir Al-Noimi wrote: > Hi guys, > > I want to save the content of QTextEdit to the database through > QSqlQuery... how can I do that? > > Running textEdit->toHtml() won't work because the returned string has > many illegal characters to execute into sql.
If you are trying to get a string from a QTextEdit for use as a string value in an SQL command to run with QSqlQuery::exec(), then I suspect the question you really want to ask is "how do I write a string value in SQL?". This is not a Qt-specific question, but a question about SQL syntax, which should be covered in any SQL tutorial. Please be absolutely sure you understand what "SQL injection attack" means and how to avoid it when doing this kind of work. Alternatively, you could use QSqlTableModel. The model takes care of the SQL generation for you. The QDataWidgetMapper class can bind a widget to a column in the model. Mark _______________________________________________ Interest mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/interest
