1.转为带参数查询
String sql=""select id from student where name='?';
Connection connect = DriverManager.getConnection("jdbc:mysql://10.82.80.7:3306/haitao", "root", "123456");
PreparedStatement pStmt = connect.prepareStatement( sql);
pStmt.setString(1, name);
pStmt.executeUpdate();
2.将字符串中的单引号转换为两个单引号。

相关文章:

  • 2022-02-19
  • 2021-10-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-01
  • 2022-12-23
猜你喜欢
  • 2021-09-15
  • 2022-12-23
  • 2021-07-28
  • 2021-11-23
  • 2021-09-16
  • 2021-12-31
  • 2022-02-17
相关资源
相似解决方案