java中从数据库中模糊查询问题

2025-03-01 12:29:26
推荐回答(4个)
回答1:

Connection conn = SqlUtil.getDBConn();
Statement stmt = conn.createStatement();
ResultSet rs =
stmt.executeQuery("select * from goods_info ");
while (rs.next()) {
GoodsInfo goods = new GoodsInfo();
goods.setGoodsId(rs.getInt("goods_id"));
goods.setGoodsName(rs.getString("goods_name")); goodsList.add(goods);
}
这样输出结果

回答2:

你是不是查询语句写错了哦..

HI我..我帮你看看呢..

回答3:

请举个例子先

select top 10 * from xx_table where xxx like '%xxxx%'

回答4:

模糊查询的语句一般写法:select * from tablename where username like '%张三%'。
楼主看看你的语句写的对不对。