preparedStatement = connection.prepareStatement("select fname,lname, "
+ "sportman_code
+ "from sportman,customer "
+ "where customer.customer_code = "
+ "sportman.customer_code and fname like ? ");
String s = jTextField1.getText();
if(s.length() == 0)
s = String.valueOf(evt.getKeyChar());
s = "'%" + s;
s += "%'" ;
System.out.println(s);
preparedStatement.setString(1, s);
resultSet = preparedStatement.executeQuery();
当我写when(resultset.next)
没有进入while循环时
例如,在fname
中有lisa,但是当我输入l
时,没有进入while循环
-
这一行的右双引号在哪里
+"sportman_code
-
你不需要引用为你执行preparedStatement.setString()的模式。
s = "%" + s + "%";
try不加单引号
s= "%" +s + "%"