搞我这样 已经算丢人了!
这里有AB两个问题! 都是程序错误 大家帮我好好看看!
A
<%@ page contentType= "text/html; charset=gb2312 "%>
<%@ page import= "java.sql.* "%>
<html>
<BODY>
<%
Class.forName( "org.gjt.mm.mysql.Driver ").newInstance();
String url= "jdbc:mysql://localhost/zqswork?user=root&password=root&useUnicaode=true&characterEncoding=gb2312 ";
Connection conn=DriverManager.getConnection(url);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql= "selcet * form zqsworktable ";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()){
%> 第1个字段 <%=rs.getString(1)%>
第2个字段 <%=rs.getString(2)%>
第3个字段 <%=rs.getString(3)%>
<%}%>
<%out.println( "成功拉! ");%>
<%
rs.close();
stmt.close();
conn.close();
%>
</BODY>
</html>
B
<%@ page contentType= "text/html;charset=GBK " %>
<%@ page language= "java " import= "java.sql.* "%>
<%
Connection conn = null;
Class.forName( "org.gjt.mm.mysql.Driver ").newInstance();
conn = java.sql.DriverManager.getConnection( "jdbc:mysql://localhost/zqswork ", "root ", "root ");
if(conn==null){
System.out.println( "get Conn Error ");
}
Statement stmt=conn.createStatement();
int RS_result=0;
%>
<html>
<head>
<title> 学习 </title> </head>
<body>
<%
RS_result=stmt.executeUpda