错误的SQL指令如下:

    sqlStr = “select * from  tb_userInfo where userName=” + userName;    //错误的 sql 指令

正确的SQL指令如下:

    sqlStr = “select * from  tb_userInfo where userName=‘’” + userName + “'”;    //正确的sql指令

错误原因:userName是文本格式 , userName 左右都须加单引号 ' 。

相关文章:

  • 2022-12-23
  • 2021-09-28
  • 2021-05-23
  • 2022-03-04
  • 2022-12-23
  • 2022-02-06
  • 2022-02-09
  • 2021-12-16
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案