conn = DriverManager.getConnection(connURL);
String sqlStr = "Select * from inventory where functions" + "like ? order by brand, model";
PreparedStatement pstmt = conn.prepareStatement(sqlStr);
pstmt.setString(1, "%" + search + "%");
ResultSet rs = pstmt.executeQuery();
嗨,伙计们,我在line 2and的这段代码有错误line 4。我相信我的编码包含错误。
我怀疑我的 SQL 查询格式不正确。pstmt.setString会将search值设置?为 SQL 查询中的。
错误:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''%null%' order by brand, model' at line 1