<%@ page contentType="text/html; charset=GBK" %>
<html>
<head>
<title>
Delete Employee Processing
</title>
</head>
<%@ page language="java" import="java.sql.*" %>
<body>
<%
Class.forName("org.gjt.mm.mysql.Driver");
String eid = request.getParameter("eid");
Connection myConn = DriverManager.getConnection("jdbc:mysql://192.168.0.99:3306/MyCo","root","");
Statement stmt = myConn.createStatement();
int rowsAffected = stmt.executeUpdate("delete from employee where empid=" + eid);(
if(rowsAffected == 1){报语法或者存取权限错为什么?????}
%>
<h1>Successful Deletion of an employee</a></h1>
The Record has been deleted
<p>
<a href="dbquery.jsp"> See all employee</a><br>
<a href="detquery.jsp">See department</a><br>
<a href="control.html>Go back to control</a>
<%
}else{
%>
<h1>sorry ,delete has failed</h1>
<a href="control.html">Go back to control center </a>
<%
}
stmt.close();
myConn.close();
%>
</body>
</html>
stmt有executeUpdate这个方法吗?
你的:
eid);(
if(rowsAffected == 1){报语法或者存取权限错为什么?????}
里if前面的那个“(”好象有问题吧。
另外你的这些访问数据库的代码最好放在一个try{}catch(Exception e){}里!