亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

JSP寫好的代碼并沒有顯示錯誤,但是運行時出錯了,并且提示的地方并沒有問題

JSP寫好的代碼并沒有顯示錯誤,但是運行時出錯了,并且提示的地方并沒有問題

qq_風雨中堅強_0 2016-06-04 10:38:46
<%--?? ? Document ? : Updatemysql? ? Created on : 2016-6-4, 10:01:31? ? Author ? ? : zhanghuiqing--%><%@page import="java.sql.ResultSet"%><%@page import="java.sql.Statement"%><%@page import="java.sql.Connection"%><%@page import="java.sql.DriverManager"%><%@page contentType="text/html" pageEncoding="UTF-8"%><!DOCTYPE html><html>? ? <head>? ? ? ? <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">? ? ? ? <title>JSP Page</title>? ? </head>? ? <body>? ? ? ? <%!? ? ? ? ? ?Connection con;? ? ? ? ? ?Statement st;? ? ? ? ? ?ResultSet rs;? ? ? ? %>? ? ? ? <%? ? ? ? ? try{? ? ? ? ? ? Class.forName("com.mysql.jdbc.Driver");? ? ? ? ? ? Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/mytest","root","");? ? ? ? ? ? Statement st=con.createStatement();? ? ? ? ? ? ResultSet rs=st.executeQuery("select * from course");? ? ? ? ? }? ? ? ? ? catch(Exception e){? ? ? ? ? ? ? e.printStackTrace();? ? ? ? ? }? ? ? ? ? ??? ? ? ? %>? ? ? ? <br>? ? ? ? <table border="1" bordercolor="#FF0000" bgcolor="#EFEFEF" width="400">? ? ? ? ? ? <tr bgcolor="CCCCCC" align="center">? ? ? ? ? ? ? ? <td>課程號</td>? ? ? ? ? ? ? ? <td>課程名</td>? ? ? ? ? ? ? ? <td>教師號</td>? ? ? ? ? ? </tr>? ? ? ? ? ? <tr align="center">? ? ? ? ? ? ? ? <td><%=rs.getInt("cno")%></td>? ? ? ? ? ? ? ? <td><%=rs.getString("cname")%></td>? ? ? ? ? ? ? ? <td><%=rs.getInt("tno")%></td>? ? ? ? ? ? </tr>? ? ? ? </table>? ? ? ? ? ? <%? ? ? ? ? ? ? ?try{? ? ? ? ? ? ? ? ? ?int count=st.executeUpdate("Update course set cname='Servlet' where cno='1017'");? ? ? ? ? ? ? ? ? ?if(count!=0){? ? ? ? ? ? ? ? ? ? ? ?System.out.print("影響行數"+count);? ? ? ? ? ? ? ? ? ? ? ?rs=st.executeQuery("select * from course");? ? ? ? ? ? ? ? ? ?}? ? ? ? ? ? ? ?}? ? ? ? ? ? ? ?catch(Exception e){? ? ? ? ? ? ? ? ? ?e.printStackTrace();? ? ? ? ? ? ? ?}? ? ? ? ? ? %>? ? ? ? ? ? <br>? ? ? ? ? ? 更新后的記錄? ? ? ? ? ? <br>? ? ? ? ? ? <table border="1" bordercolor="#FF0000" bgcolor="#EFEFEF" width="400">? ? ? ? ? ? <tr bgcolor="CCCCCC" align="center">? ? ? ? ? ? ? ? <td>課程號</td>? ? ? ? ? ? ? ? <td>課程名</td>? ? ? ? ? ? ? ? <td>教師號</td>? ? ? ? ? ? </tr>? ? ? ? ? ? <%rs.first();%>? ? ? ? ? ? <tr align="center">? ? ? ? ? ? ? ? <td><%=rs.getInt("cno")%></td>? ? ? ? ? ? ? ? <td><%=rs.getString("cname")%></td>? ? ? ? ? ? ? ? <td><%=rs.getInt("tno")%></td>? ? ? ? ? ? </tr>? ? ? ? ? ? </table>? ? ? ? ? ? <%? ? ? ? ? ? ? ?rs.close();? ? ? ? ? ? ? ?st.close();? ? ? ? ? ? ? ?con.close();? ? ? ? ? ? %>? ? </body></html>
查看完整描述

1 回答

?
_瀟瀟暮雨

TA貢獻646條經驗 獲得超225個贊

報什么錯啊?

查看完整回答
反對 回復 2016-06-04
  • 1 回答
  • 0 關注
  • 1826 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號