SQL select statement with where clause

前端 未结 6 1330
醉话见心
醉话见心 2020-12-30 16:39

how would i write this sql statement without a hard coded value?

resultSet = statement
    .executeQuery(\"select * from myDatabase.myTable where name = \'jo         


        
6条回答
  •  没有蜡笔的小新
    2020-12-30 17:27

    this should work:

    String name = "john"; 
    resultSet = statement
        .executeQuery("select * from myDatabase.myTable where name =" + "'" + name + "'");
    

提交回复
热议问题