增刪改查
<%--
Created by IntelliJ IDEA.
User: 和
Date: 2020/9/23
Time: 9:16
To change this template use File | Settings | File Templates.
--%>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.Driver" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.Statement" %><%--
Created by IntelliJ IDEA.
User: 了
Date: 2020/9/23
Time: 9:21
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title></title>
</head>
<body>
<jsp:useBean id="user" class="com.media.bean.UserBean" scope="application"></jsp:useBean>
<jsp:setProperty name="user" property="*"></jsp:setProperty>
<%
//UserBean user1=new UserBean();
//user.setUsername(request.getParameter("username"));
//out.print(user.getUsername());
//載入驅動程式
Class.forName("com.mysql.jdbc.Driver");
//建立資料庫連線
String url = "jdbc:mysql://127.0.0.1:3306/book?user=root&password=root";
Connection connection = DriverManager.getConnection(url);//獲得連結物件
String sql = "INSERT INTO user (username,password,gender,age) VALUES('"+user.getUsername()+"','"+user.getPassword()+"',1,23)";
Statement stmt = connection.createStatement();
//String sql="update user set status = 5 where id = 13";
// String sql="delete from user where id=12";
int count = stmt.executeUpdate(sql);
if(count > 0){
out.print("註冊成功");
}else {
out.print("註冊失敗");
}
%>
</body>
</html>
相關文章
- SQL增刪改查SQL
- Mongoose查增改刪Go
- indexedDB 增刪改查Index
- mysql增刪改查MySql
- 列表的增刪改查
- 字典的增刪改查
- mongodb 基本增刪改查MongoDB
- MongoDB增刪改查操作MongoDB
- layui的增刪改查UI
- 單表增刪改查
- mybatis的增刪改查MyBatis
- EFCore之增刪改查
- redist的增刪改查Redis
- sql指令,增,刪,查,改SQL
- mysql基本增刪改查MySql
- iOS CoreData (一) 增刪改查iOS
- Jfinal+layui增刪改查UI
- SQL 基礎增、刪、改、查SQL
- elasticsearch7.2增刪改查Elasticsearch
- [express+mongoose](增刪改查)ExpressGo
- CoreData - 簡單 增刪改查
- C# SqlSugar增刪改查C#SqlSugar
- rust sqlx 使用---增刪改查RustSQL
- PHP操作MongoDB(增刪改查)PHPMongoDB
- JavaWeb中jdbc增刪查改JavaWebJDBC
- 基本 SQL 之增刪改查(二)SQL
- JavaScript表格增刪改查詳解JavaScript
- MySQL基礎操作(增刪改查)MySql
- Kendo UI:grid完成增刪改查(*)UI
- mysql資料增刪改查操作MySql
- 02-CoreData 的增刪改查
- Layui(4) 增刪改查 完整案例UI
- JS字串操作之增刪改查JS字串
- 筆記03:sqlalchemy增刪改查筆記SQL
- cobra.Command的增刪改查
- Python中CRUD增刪改查教程Python
- js實現表格的增刪改查JS
- linux-MySQL基本指令-增刪改查LinuxMySql