主题:[求助]搞一天了,还是不行,请帮帮
<%@page contentType="text/html;charset=gb2312"%>
<%@page import="java.sql.*"%>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<html>
<head>
<title>mysql</title>
</head>
<body>
<%
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
String url="jdbc:mysql://localhost/jsp?user=root&password=123&useUnicode=true&characterEncoding=gb2312";
Connection conn=DriverManager.getConnection(url);
Statement stmt=conn.createStatement();
String sql="insert into user(name,pass)values('ha','hahah')";
try{
stmt.executeQuery(sql);
stmt.close();
conn.close();
}catch(Exception e){out.print(e.toString());}
%>
</body>
</html>
JDBC已经有了
浏览时IE.6上显示java.sql.SQLException: Can not issue data manipulation statements with executeQuery()
请问一下该怎么改,谢谢
<%@page import="java.sql.*"%>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<html>
<head>
<title>mysql</title>
</head>
<body>
<%
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
String url="jdbc:mysql://localhost/jsp?user=root&password=123&useUnicode=true&characterEncoding=gb2312";
Connection conn=DriverManager.getConnection(url);
Statement stmt=conn.createStatement();
String sql="insert into user(name,pass)values('ha','hahah')";
try{
stmt.executeQuery(sql);
stmt.close();
conn.close();
}catch(Exception e){out.print(e.toString());}
%>
</body>
</html>
JDBC已经有了
浏览时IE.6上显示java.sql.SQLException: Can not issue data manipulation statements with executeQuery()
请问一下该怎么改,谢谢