标签:local etc root tle localhost 修改 character odi weight
1 <%@page import="java.sql.*"%> 2 <%@ page language="java" contentType="text/html; charset=UTF-8" 3 pageEncoding="UTF-8"%> 4 <!DOCTYPE html> 5 <html> 6 <head> 7 <meta charset="UTF-8"> 8 <title>修改记录页面</title> 9 </head> 10 <body> 11 <% 12 String className="com.mysql.jdbc.Driver"; 13 String user="root"; 14 String password="root"; 15 String url="jdbc:mysql://localhost:3306/db_shangke"; 16 Connection conn=DriverManager.getConnection(url, user, password); 17 request.setCharacterEncoding("utf-8"); 18 String sql="update stu_info set weight=? where name=?"; 19 PreparedStatement pstmt=conn.prepareStatement(sql); 20 pstmt.setFloat(1, 80); 21 pstmt.setString(2, "张三"); 22 int n=pstmt.executeUpdate(); 23 if(n==1){ 24 %>数据修改操作成功!<br><% 25 }else { 26 %>数据修改操作失败!<br><% 27 } 28 if(pstmt!=null){ 29 pstmt.close(); 30 } 31 if(conn!=null){ 32 conn.close(); 33 } 34 %> 35 </body> 36 </html>
标签:local etc root tle localhost 修改 character odi weight
原文地址:https://www.cnblogs.com/dss-99/p/14673701.html