Getting one value from SQL select statement in Java

前端 未结 6 894
野性不改
野性不改 2020-12-18 04:27

I\'m trying to return a value from a select statement. Its only one value because the value I\'m returning is from the primary key column.

The SQL statement is

6条回答
  •  执念已碎
    2020-12-18 05:03

    You need to change

    while (rs.next())
        value = rs.toString();
    

    to

     while (rs.next())
        value = rs.getString("itemNo");
    

提交回复
热议问题