【发布时间】:2021-06-17 19:15:23
【问题描述】:
我试图获取数据库中名称列包含“jansen”的特定值,但是当我运行我的代码时,它会显示这样的错误
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'jansen' in 'where clause'
这是我的代码
try {
Statement stmt=MyConnection.getConnection().createStatement();
ResultSet rs=stmt.executeQuery("select * from emp where name = jansen");
while(rs.next())
System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "+rs.getString(3));
}catch (Exception e){
System.out.println(e);
}
[这是我在 Sqlyog 中的数据库]
【问题讨论】: