<%@ page contentType="text/html;charset=GB2312" %>
<%@ page import="java.sql.*" %>
<HTML>
<BODY>
<% //获取提交的姓氏：
    	String name=request.getParameter("name");
     	if(name==null) {name=""; }
     	byte b[]=name.getBytes("ISO-8859-1"); 
	name=new String(b);
    	String number,xingming; 
	Connection con=null; 
	Statement sql=null; 
	ResultSet rs=null;
    	int cz,wj,sj;
     	try{
		Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
	   }
     	catch(ClassNotFoundException e){}
     	try{ 
		con=DriverManager.getConnection("jdbc:odbc:sun","sa",""); 
		sql=con.createStatement();
         	String condition="SELECT * FROM student" ; 
		rs=sql.executeQuery(condition);
       		out.print("<TABLE Border>");
         	out.print("<TR>");
         	out.print("<TH width=100>"+"学号"); 
		out.print("<TH width=100>"+"姓名");
         	out.print("<TH width=50>"+"操作系统"); 
		out.print("<TH width=50>"+"微机原理");
         	out.print("<TH width=50>"+"数据结构");
         	out.print("</TR>");
       		while(rs.next())
           	{ 
			number=rs.getString(1); 
			xingming=rs.getString(2);
             		if(xingming.startsWith("王"))
               		{ 
				out.print("<TR>");
                 		out.print("<TD >"+number+"</TD>"); 
                 		out.print("<TD >"+xingming+"</TD>");
                 		cz=rs.getInt(3); out.print("<TD >"+cz+"</TD>");
                 		wj=rs.getInt(4); out.print("<TD >"+wj+"</TD>");
                 		sj=rs.getInt(5); out.print("<TD >"+sj+"</TD>");
                 		out.print("</TR>") ;  
               	}
	} 
        out.print("</TABLE>"); 
	con.close();
     }
    catch(SQLException e) {  }
%>
</BODY>
</HTML>
