in the DLL
Other information: You have an error in your SQL syntax; Check the manual that corresponds to your MySQL server version for the right syntax to use near "'") at the line 1
Relevant code to the
sqlCon. The Open ();
String ReceiveMessagecom1="INSERT INTO history (time, operation) VALUES ('" + DateTime. Now. ToLocalTime (), ToString () + "', " "+ ReceiveMessage +" \ ") ";
MySqlCommand com2=new MySqlCommand (ReceiveMessagecom1 sqlCon);
Com2. ExecuteNonQuery ();
SqlCon. Close ();
ReceiveMessage value is UPDATE ` brigade big 16-3 ` SET bar SET to complete the sign up='inspection declaration IN the WHERE one pipe size=' DO - LDB01-35068-01 AND joint number='FWS - 1 AND line number=' 2 \ "- DO - 35068 - A2BZ - HT35 'before the error, perform the ReceiveMessage value is the SELECT * FROM ` brigade big 16-3 ` WHERE drawing batch number IN (SELECT drawings FROM job category WHERE id=' 1 ') AND joint number!=' 'and bar set to complete the sign up="' or group member to complete the sign up='repair'
Perform when I was a success and error of the statements in the MYSQL executed is successful, does anyone know why this error, please, ask bosses give directions
CodePudding user response:
Post for the first time, have a big to visitCodePudding user response:
Insert in the set of a update? Haven't seen this kind of writingCodePudding user response:
This is recorded every implementation for mysql statement, behind there are records of plain textCodePudding user response:
And this is not a nested, just insert in a string of a string, the string is just a SQL statementCodePudding user response:
1, if it is a plain text, you this statement and there is no stitching on '2, the inner text with special characters', need to ' '
CodePudding user response:
ReceiveMessagecom1="INSERT INTO history (time, operation) VALUES (' 2021-01-14 10:47:10, " UPDATE ` brigade big 16-3 ` SET bar SET to complete the sign up='inspection declaration in the WHERE one pipe size=' DO - LDB01-35068-02 'AND joint number=' FW - 10 AND line number='2 \ "- DO - 35068 - A2BZ - HT35' ") "Put this statement in mysql to perform as a result of such
But the statement in vs
MySqlCommand com2=new MySqlCommand (ReceiveMessagecom1 sqlCon);complains, quote is above '") of the error, this is what reason, how to change
Com2. ExecuteNonQuery ();
But ReceiveMessagecom1="INSERT INTO history (time, operation) VALUES (' 2021-01-14 10:47:10, " SELECT * FROM 16-3 ` ` force big batch number IN the where drawings (SELECT drawings FROM job category where id='1') and joint number!=' 'and bar set to complete the sign up="' or group member to complete the sign up='repair' \ ") "this is v, there is no error
CodePudding user response:
Print ReceiveMessagecom1 under the variable.Check whether printed the SQL statements in line with expectations, is grammatically correct.
CodePudding user response:
I this to is carry out the VS ReceiveMessagecom1 valuesCodePudding user response:
Breakpoint debugging ReceiveMessagecom1 values, then put her in the database and perform and see what is wrong! Should be carried out that string string is MySql, so an error!CodePudding user response:
This is VS without error, but insert the update statement above would be an error
CodePudding user response:
I above the MYSQL the execution of the figure, given is the value of ReceiveMessagecom1 implementation in MYSQL, can be directly executed successfullyCodePudding user response:
String ReceiveMessage=@ "' UPDATE ` brigade big 16-3 ` SET bar SET for='sign' inspection in ' 'WHERE one pipe size=' 'DO - LDB01-35068-01' 'AND joint number=' 'FWS - 1' AND line number=' '- DO - 35068-2 A2BZ HT35 -' ' 'WHERE LogID=' 2 a45e58c - A5A5-48 f9-9738-01 de3c06ab16 '"CodePudding user response:
String ReceiveMessage=@ "' UPDATE ` brigade big 16-3 ` SET bar SET for='sign' inspection in ' 'WHERE one pipe size=' 'DO - LDB01-35068-01' 'AND joint number=' 'FWS - 1' AND line number=' '- DO - 35068-2 A2BZ HT35 -' ' 'WHERE LogID=' 2 a45e58c - A5A5-48 f9-9738-01 de3c06ab16 '";CodePudding user response: