【急~】jsp以下sql查询语句为什么会报错?
org.apache.jasper.JasperException:ExceptioninJSP:/orderBook.jsp:49Youhaveanerrorinyou...
org.apache.jasper.JasperException: Exception in JSP: /orderBook.jsp:49
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 '?' at line 1
我的jsp文件对应代码:
46 String sql2 = "select price from provide_book where isbn = ?";
47 PreparedStatement stmt2 = conn.prepareStatement(sql2);
48 stmt2.setString(1,isbn);
49 ResultSet rs = stmt2.executeQuery(sql2);
'?'应该代表的是要传进去的参数 为什么这样不行呢?
以下语句可以通过:
String sql = "insert into want_book values(?,?,?,?,?,?,?,?,?,?)"; 展开
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 '?' at line 1
我的jsp文件对应代码:
46 String sql2 = "select price from provide_book where isbn = ?";
47 PreparedStatement stmt2 = conn.prepareStatement(sql2);
48 stmt2.setString(1,isbn);
49 ResultSet rs = stmt2.executeQuery(sql2);
'?'应该代表的是要传进去的参数 为什么这样不行呢?
以下语句可以通过:
String sql = "insert into want_book values(?,?,?,?,?,?,?,?,?,?)"; 展开
3个回答
展开全部
点击韦涵涵,加我一定帮你解决...
祝楼主早日成功!
祝楼主早日成功!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
要把代码都贴出来
46 String sql2 = "select price from provide_book where isbn = ?";
47 PreparedStatement stmt2 = conn.prepareStatement(sql2);
48 stmt2.setString(1,isbn);
49 ResultSet rs = stmt2.executeQuery();
试试
46 String sql2 = "select price from provide_book where isbn = ?";
47 PreparedStatement stmt2 = conn.prepareStatement(sql2);
48 stmt2.setString(1,isbn);
49 ResultSet rs = stmt2.executeQuery();
试试
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询