Query for searching the name alphabetically

前端 未结 5 1276
梦谈多话
梦谈多话 2020-12-12 06:04

I have used the LIKE condition, but it required me to enter the full name into the database to find the name.



        
5条回答
  •  半阙折子戏
    2020-12-12 06:18

    Instead of this:

    StringBuilder sb = new StringBuilder();
    while (rs.next()) {
    String name = rs.getString("Name");
    sb.append(name + " ");
    }
    

    Use this:

    List lstNames = new ArrayList();
    while (rs.next()) {
       lstNames.add(rs.getString("Name"));
    }
    

提交回复
热议问题