Home > Net >  Why is an error
Why is an error

Time:01-15

"MySql Data. MySqlClient. MySqlException" type of untreated abnormalities in MySql. Data.
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 visit

CodePudding user response:

Insert in the set of a update? Haven't seen this kind of writing

CodePudding user response:

This is recorded every implementation for mysql statement, behind there are records of plain text

CodePudding user response:

And this is not a nested, just insert in a string of a string, the string is just a SQL statement

CodePudding 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); 
Com2. ExecuteNonQuery ();
complains, quote is above '") of the error, this is what reason, how to change

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 values

CodePudding 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 successfully

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:

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:

refer to the eighth floor weixin_54582889 response:
I this to is carry out the ReceiveMessagecom1 VS the value of the

Print it out and see this is a bit different, printed there was now no escape characters. Sometimes more than a symbolic less easy reading a symbol, so it is recommended that you print it out.

CodePudding user response:

Wtnu200 brother hair of what the code is doing

CodePudding user response:

What is the print

CodePudding user response:

reference 13 floor wtnu200 reply:
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 '";
what is the meaning of this

CodePudding user response:

your statement is an error because the value of the ReceiveMessage has a problem, I will show you the first reply,,,

CodePudding user response:

On the 14th floor ziqi0716
reference response:
Quote: refer to the eighth floor weixin_54582889 response:
I this to is carry out the VS ReceiveMessagecom1 values

Print it out and see this is a bit different, printed there was now no escape characters. Sometimes more than a symbolic less easy reading a symbol, so it is recommended that you print it out to see.


Brother told me how to print it out, the whole out I see

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • C#
  • Related