select * from t_user where username like %?%怎么写入程序中
Connectionconn=newConnectionFactory().getConnection();Stringsql="select*fromt_userwhe...
Connection conn = new ConnectionFactory().getConnection();
String sql = "select * from t_user where username %?%";
PreparedStatement pstm = conn.prepareStatement(sql);
pstm.setString(1, partOfName);
ResultSet rs = pstm.executeQuery();
老报语法错误 郁闷死。。。。
String sql = "select * from t_user where username like '%?%'";
这样也是报错的:
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 '%'2'%' at line 1 展开
String sql = "select * from t_user where username %?%";
PreparedStatement pstm = conn.prepareStatement(sql);
pstm.setString(1, partOfName);
ResultSet rs = pstm.executeQuery();
老报语法错误 郁闷死。。。。
String sql = "select * from t_user where username like '%?%'";
这样也是报错的:
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 '%'2'%' at line 1 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询