注册 登录
编程论坛 J2EE论坛

jsp与mysql的数据修改问题???

zimu001 发布于 2006-05-25 11:13, 548 次点击

大家帮我看看为什么会错啊???多谢了

<%@page import="java.sql.*" %>
<%@page import="javax.servlet.*" %>
<%@page contentType="text/html;charset=gb2312" %>

<html>

<head>
<title>新建网页 1</title>
</head>

<body>
<%

String driver="org.gjt.mm.mysql.Driver";
Class.forName(driver).newInstance();
String conURL="jdbc:mysql://localhost/my";
Connection con=null;
con=DriverManager.getConnection(conURL,"root","");
Statement stmt=null;
stmt=con.createStatement();
String sqlst="";
ResultSet rs=null;

<!-- weihuanshushu 在数据库里是int型的.我用的是mysql数据库 -->
sqlst="UPDATE duzhe SET weihuanshushu = weihuanshushu +1 WHERE bianhao=1;";
rs=stmt.executeUpdate(sqlst);
%>
</body>

</html>

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 12 in the jsp file: /bysj/cheshi2.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bysj\cheshi2_jsp.java:69: incompatible types
found : int
required: java.sql.ResultSet
rs=stmt.executeUpdate(sqlst);
^
1 error

0 回复
1