<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<html>
<head>
<title>插入数据</title>
</head>
<body bgcolor=pink>
<font size=1>
<%
String number=request.getParameter("number");
if(number==null)
{number="";
}
byte b[]=number.getBytes("ISO-8859-1");
number=new String(b);
String name=request.getParameter("name");
if(name==null)
{name="";
}
byte c[]=name.getBytes("ISO-8859-1");
name=new String(c);
String m=request.getParameter("math");
if(m==null)
{m="-100";}
String e=request.getParameter("english");
if(e==null)
{e="-100";}
String p=request.getParameter("physics");
if(p==null)
{p="-100";}
Connection con=null;
java.sql.Statement sql=null;
ResultSet rs=null;
try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");}
catch(ClassNotFoundException event){out.print(event);}
try {con=DriverManager.getConnection("jdbc:odbc:sun","sa","");
sql=con.createStatement();
String condition="insert into student values"+"("+"'"+number+", '"+name+","+m+","+e+","+p+")";
sql.executeUpdate(condition);
%>
<p>更新后的表的记录:
<%
rs=sql.executeQuery("select * from student ");
out.print("<Table border>");
out.print("<TR>");
out.print("<TH width=100>"+"学号");
out.print("<TH width=100>"+"姓名");
out.print("<TH width=100>"+"数学成绩");
out.print("<TH width=100>"+"英语成绩");
out.print("<TH width=100>"+"物理成绩");
out.print("</TR>");
while(rs.next())
{
out.print("<tr>");
String n=rs.getString(1);
out.print("<td>"+n+"</td>");
String xing=rs.getString(2);
out.print("<td>"+xing+"</td>");
int math=rs.getInt("数学成绩");
out.print("<td>"+math+"<td>");
int english=rs.getInt("英语成绩");
out.print("<td>"+english+"<td>");
int physics=rs.getInt("物理成绩");
out.print("<td>"+physics+"<td>");
out.print("</tr>");
}
out.print("</table>");
con.close();
}
catch(SQLException event){out.print(e);}
%>
</font>
</body>
</html>
帮我看看,怎么改正,谢谢