表的结构:createtablescore(numvarchar(12)primarykey,namevarchar(20),scoredecimal(5,2));JSP代码:(在里面插入查询代码)

表的结构:

create table score

(num varchar(12) primary key,

name varchar(20),

score decimal(5,2)

);

JSP代码:(在里面插入查询代码)

/p>

“http://www.w3.org/TR/html4/loose.dtd”>

JSP Page

学生成绩管理
学号
姓名
成绩
修改
删除

try{

Class.forName(“com.microsoft.jdbc.sqlserver.SQLServerDriver”);

Connection con=DriverManager.getConnection(“jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=student”, “ting”, “111”);

Statement st=con.createStatement();

ResultSet rs=st.executeQuery(“select * from score “);

String num,name;

float score;

if (rs!=null)

{

while (rs.next()){

num=rs.getString(“num”);

name=rs.getString(“name”);

score=rs.getFloat(“score”);

%>

}

rs.close();

}

st.close();

con.close();

}

catch(Exception e)

{

throw e;

}

%>

展开


版权声明:本文为weixin_39632982原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/weixin_39632982/article/details/111845853