📄 success.jsp.bak
字号:
<%@ page contentType="text/html;charset=GB2312"%>
<%@ page import="java.sql.*"%>
<html>
<body background="3.jpg">
<center>
<font size=7 color=red>
成绩查询系统
</font>
<center>
<hr>
<form>
请输入要查询学生的姓名:
<input type="text" name="sname" >
<input type="submit" value="查询">
<hr>
<%
String name,JAVA,algorithmic,compile,structure,numerical;
String sname=request.getParameter("sname");
if(sname==null)
{
sname="";
}
byte b[]=sname.getBytes("ISO-8859-1");
sname=new String(b);
if(sname!=null)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e)
{
out.print("加载驱动失败!");
}
try
{
Connection con=DriverManager.getConnection("jdbc:odbc:LogIn","sa","");
Statement sql=con.createStatement();
String condition="SELECT * FROM score WHERE 姓名='"+sname+"'";
ResultSet rs=null;
rs=sql.executeQuery(condition);
if(rs.equals("null"))
{out.print("查询的用户不存在!")}
while(rs.next())
{
out.print("<TR>");
name=rs.getString(1);
out.print("<TD>"+"姓名:"+name+"</TD>");
JAVA=rs.getString(2);
out.print("<TD>"+"JAVA:"+JAVA+"</TD>");
algorithmic=rs.getString(3);
out.print("<TD>"+"算法:"+algorithmic+"</TD>");
compile=rs.getString(4);
out.print("<TD>"+"汇编:"+compile+"</TD>");
structure=rs.getString(5);
out.print("<TD>"+"数据结构:"+structure+"</TD>");
numerical=rs.getString(6);
out.print("<TD>"+"数值分析:"+numerical+"</TD>");
out.print("</TR>");
}
con.close();
}
catch(SQLException e)
{
out.print(e);
}
}
%>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -