I have encountered a problem. When testing the editing of information, if the edited content contains a single quote ('), it will fail to be written to the MySQL database. Use the following code to print the error: if (!this->m_sql_query.prepare(update_string)) { printf("exec fail—>%s\n", this->m_sql_query.lastError().text().toStdString().c_str()); } if (!this->m_sql_query.exec()) { printf("exec fail—>%s\n", this->m_sql_query.lastError().text().toStdString().c_str()); } The printed result is: Please refer to the following relevant information: After analysis, it was found that the string in the inserted content was truncated at the single quotes when editing the SQL statement, resulting in a syntax error. Solution : Replace the characters containing single quotes (') with (''). SQL uses two single quotes instead of one single quote. This is the end of this article about the in-depth explanation of the problem of failure to write English single quotes "'" in SQL. For more related content about failure to write English single quotes "'" in SQL, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Docker Machine in-depth explanation
>>: Some points on using standard HTML codes in web page creation
We all know the drag-and-drop feature of HTML5, w...
The full name of Blog should be Web log, which me...
<br />Previous article: Web Design Tutorial ...
Table of contents 1. Leftmost prefix principle 2....
Robots.txt is a plain text file in which website ...
1. Overview of SQLException When an error occurs ...
Preface This article mainly introduces the releva...
Detailed explanation of MySQL exporting data from...
1. Enable remote access to the docker server Log ...
This article shares the specific code of JavaScri...
Table of contents map filter some every findIndex...
Table of contents Congruent and Incongruent congr...
Server placement It is recommended to use cloud s...
In this article, we will use the libudev library ...
<br />This site’s original content, please i...