Unknown column '××' in 'where clause', the emergence of this problem, how to deal with?

stmt.executeQuery("select * from user where username = " + name);

This code is executed it will trigger the error.

The reason is: when pieced sql statement to character type data is not enclosed in quotation marks

Change to correct the following statement

stmt.executeQuery("select * from user where username = '" + name + "'");

Guess you like

Origin www.cnblogs.com/woxiaosade/p/10963679.html