当前位置: 代码迷 >> J2EE >> 是剔除语句错了么
  详细解决方案

是剔除语句错了么

热度:84   发布时间:2016-04-22 01:02:05.0
是删除语句错了么?

可以执行,可是执行后想删除的那一列还在,

请问这是什么问题?

部分代码如下:
<%@
page import="java.sql.*,wcl.*"
%>

<%
String s = request.getParameter("id");


Connection conn = null;
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://localhost/justshow?user=root&password=123");
Statement stmt = conn.createStatement();

stmt.executeUpdate("delete from xueyi where tanwei="+"'s'");
System.out.println("hao");


stmt.close();
conn.close();
%>
[b][/b][size=16px][/size]

------解决方案--------------------
stmt.executeUpdate("delete from xueyi where tanwei='"+ s + "'");
------解决方案--------------------
连接数据库的链接没有端口号:
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/justshow?user=root&password=123");
------解决方案--------------------
同意1楼,s是Java里的变量
------解决方案--------------------
'"+ s + "'
  相关解决方案