商品销售管理系统

用JSPservlet和jquery以及SQLServer数据库实现商品销售管理系统。功能详解:1.查询商品2.添加商品3.删除商品4.添加销售记录5.查看销售记录效果演示:进入界面商品显示页面删除提示销售记录查询商品销售系统需要SQLServer数据库和程序两大部分一:设计并实现数据库二:程序设计在程序正式开始之前先看一下目录结构吧==特别注意:==…

大家好,又见面了,我是你们的朋友全栈君。

用JSP servlet和jquery以及SQLServer数据库实现商品销售管理系统。

功能详解:
1.查询商品
2.添加商品
3.删除商品
4.添加销售记录
5.查看销售记录

效果演示:

进入界面
在这里插入图片描述
商品显示页面
在这里插入图片描述
删除提示
在这里插入图片描述
销售记录查询
在这里插入图片描述

商品销售系统需要SQLServer数据库和程序两大部分

一:设计并实现数据库

在这里插入图片描述

二:程序设计

在程序正式开始之前先看一下目录结构吧
在这里插入图片描述
==特别注意:==引入sqljdbc4.jar和jquery-3.3.1.js架包

程序演示

bean包

Product.java

package com.hnpi.bean;

public class Product { 
   
	private int ProductID;
	private String ProductName;
	private String IsUp;
	private int UnitPrice;
	private String Remark;
	public int getProductID() { 
   
		return ProductID;
	}
	public void setProductID(int productID) { 
   
		ProductID = productID;
	}
	public String getProductName() { 
   
		return ProductName;
	}
	public void setProductName(String productName) { 
   
		ProductName = productName;
	}
	public String getIsUp() { 
   
		return IsUp;
	}
	public void setIsUp(String isUp) { 
   
		IsUp = isUp;
	}
	public int getUnitPrice() { 
   
		return UnitPrice;
	}
	public void setUnitPrice(int unitPrice) { 
   
		UnitPrice = unitPrice;
	}
	public String getRemark() { 
   
		return Remark;
	}
	public void setRemark(String remark) { 
   
		Remark = remark;
	}
	public Product() { 
   
		super();
		// TODO Auto-generated constructor stub
	}
	public Product(int productID, String productName, String isUp,
			int unitPrice, String remark) { 
   
		super();
		ProductID = productID;
		ProductName = productName;
		IsUp = isUp;
		UnitPrice = unitPrice;
		Remark = remark;
	}
	
	
	
	

}

Sale.java

package com.hnpi.bean;

import java.util.Date; public class Sale { 
   
	private int SaleID;
	private String SalePerson;
	private int Amount;
	private Date SaleDate;
	private int ProductID; public int getSaleID() { 
   
		return SaleID;
	}
	public void setSaleID(int saleID) { 
   
		SaleID = saleID;
	}
	public String getSalePerson() { 
   
		return SalePerson;
	}
	public void setSalePerson(String salePerson) { 
   
		SalePerson = salePerson;
	}
	public int getAmount() { 
   
		return Amount;
	}
	public void setAmount(int amount) { 
   
		Amount = amount;
	}
	public Date getSaleDate() { 
   
		return SaleDate;
	}
	public void setSaleDate(Date saleDate) { 
   
		SaleDate = saleDate;
	}
	public int getProductID() { 
   
		return ProductID;
	}
	public void setProductID(int productID) { 
   
		ProductID = productID;
	}
	public Sale() { 
   
		super();
		// TODO Auto-generated constructor stub
	}
	public Sale(int saleID, String salePerson, int amount, Date saleDate, int productID) { 
   
		super();
		SaleID = saleID;
		SalePerson = salePerson;
		Amount = amount;
		SaleDate = saleDate;
		ProductID = productID;
	}
	
	
	
	

}

servlet包

AddServlet.java

package com.hnpi.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.hnpi.bean.Product;
import com.hnpi.util.DBUtil;
public class AddServlet extends HttpServlet { 

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { 

doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { 

request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
String ProductName = request.getParameter("ProductName");
String IsUp = request.getParameter("IsUp");
String UnitPrice = request.getParameter("UnitPrice");
String Remark = request.getParameter("Remark");
Connection conn = DBUtil.getConn();
PreparedStatement ps = null;
String sql = "insert into Product(ProductName, IsUp, UnitPrice, Remark) values(?,?,?,?)";
try { 

ps = conn.prepareStatement(sql);
ps.setString(1, ProductName);
ps.setString(2, IsUp);
ps.setInt(3, Integer.parseInt(UnitPrice));
ps.setString(4, Remark);
ps.executeUpdate();
} catch (SQLException e) { 

// TODO Auto-generated catch block
e.printStackTrace();
}finally{ 

DBUtil.closeConn(conn, ps, null);
}
response.sendRedirect("list");
}
}

DeleteServlet.java

package com.hnpi.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.hnpi.util.DBUtil;
public class DeleteServlet extends HttpServlet { 

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { 

doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { 

request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
String id = request.getParameter("id");
Connection conn = DBUtil.getConn();
PreparedStatement ps = null;
String sql = "delete from Product where ProductID = ?";
try { 

ps = conn.prepareStatement(sql);
ps.setInt(1, Integer.parseInt(id));
ps.executeUpdate();
} catch (SQLException e) { 

// TODO Auto-generated catch block
e.printStackTrace();
}finally{ 

DBUtil.closeConn(conn, ps, null);
}
response.sendRedirect("list");
}
}

InsertServlet.java

package com.hnpi.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Currency;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.hnpi.util.DBUtil;
public class InsertServlet extends HttpServlet { 

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { 

doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { 

request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
String ProductName = request.getParameter("ProductName");
String Amount = request.getParameter("Amount");
String SalePerson = request.getParameter("SalePerson");
Connection conn = DBUtil.getConn();
PreparedStatement ps = null;
String sql = "insert into Sale(SalePerson, Amount, SaleDate, ProductID) values(?,?,?,?)";
try { 

ps = conn.prepareStatement(sql);
ps.setString(1, SalePerson);
ps.setInt(2, Integer.parseInt(Amount));
ps.setTimestamp(3, new Timestamp(System.currentTimeMillis()));
ps.setInt(4, 3);
ps.executeUpdate();
} catch (SQLException e) { 

// TODO Auto-generated catch block
e.printStackTrace();
}finally{ 

DBUtil.closeConn(conn, ps, null);
}
response.sendRedirect("select");
}
}

ListChoseServlet

package com.hnpi.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.hnpi.bean.Product;
import com.hnpi.util.DBUtil;
public class ListChoseServlet extends HttpServlet { 

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { 

doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { 

request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
String ProductName = request.getParameter("ProductName");
String Remark = request.getParameter("Remark");
Connection conn = DBUtil.getConn();
PreparedStatement ps = null;
ResultSet rs = null;
String sql = "select * from Product where ProductName = ? and Remark = ?";
List<Product> products = new ArrayList<Product>();
try { 

ps = conn.prepareStatement(sql);
ps.setString(1, ProductName);
ps.setString(1, Remark);
rs = ps.executeQuery();
while(rs.next()){ 

Product product = new Product();
product.setProductID(rs.getInt(1));
product.setProductName(rs.getString(2));
product.setIsUp(rs.getString(3));
product.setUnitPrice(rs.getInt(4));
product.setRemark(rs.getString(5));
products.add(product);
}
} catch (SQLException e) { 

// TODO Auto-generated catch block
e.printStackTrace();
}finally{ 

DBUtil.closeConn(conn, ps, rs);
}
HttpSession session = request.getSession();
session.setAttribute("productList", products);
response.sendRedirect("list.jsp");
}
}

ListServlet.java

package com.hnpi.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.hnpi.bean.Product;
import com.hnpi.util.DBUtil;
import com.sun.net.httpserver.HttpsServer;
public class ListServlet extends HttpServlet { 

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { 

doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { 

request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
String ProductName = request.getParameter("ProductName");
String Remark = request.getParameter("Remark");
Connection conn = DBUtil.getConn();
PreparedStatement ps = null;
ResultSet rs = null;
String sql = "select * from Product";
List<Product> products = new ArrayList<Product>();
try { 

ps = conn.prepareStatement(sql);
rs = ps.executeQuery();
while(rs.next()){ 

Product product = new Product();
product.setProductID(rs.getInt(1));
product.setProductName(rs.getString(2));
product.setIsUp(rs.getString(3));
product.setUnitPrice(rs.getInt(4));
product.setRemark(rs.getString(5));
products.add(product);
}
} catch (SQLException e) { 

// TODO Auto-generated catch block
e.printStackTrace();
}finally{ 

DBUtil.closeConn(conn, ps, rs);
}
HttpSession session = request.getSession();
session.setAttribute("productList", products);
response.sendRedirect("list.jsp");
}
}

SelectServlet.java

package com.hnpi.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.hnpi.bean.Product;
import com.hnpi.bean.Sale;
import com.hnpi.util.DBUtil;
public class SelectServlet extends HttpServlet { 

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { 

doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { 

request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
Connection conn = DBUtil.getConn();
PreparedStatement ps = null;
ResultSet rs = null;
String sql = "select * from Sale";
List<Sale> sales = new ArrayList<Sale>();
try { 

ps = conn.prepareStatement(sql);
rs = ps.executeQuery();
while(rs.next()){ 

Sale sale = new Sale();
sale.setSaleID(rs.getInt(1));
sale.setSalePerson(rs.getString(2));
sale.setAmount(rs.getInt(3));
sale.setSaleDate(rs.getDate(4));
sale.setProductID(rs.getInt(5));
sales.add(sale);
}
} catch (SQLException e) { 

// TODO Auto-generated catch block
e.printStackTrace();
}finally{ 

DBUtil.closeConn(conn, ps, rs);
}
HttpSession session = request.getSession();
session.setAttribute("saleList", sales);
response.sendRedirect("select.jsp");
}
}

util包

DBUtil.java

package com.hnpi.util;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class DBUtil { 

public static Connection getConn(){ 

String url = "jdbc:sqlserver://localhost:1433;databaseName=Test";
String user = "sa";
String pwd = "1";
Connection conn = null;
try { 

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
conn = DriverManager.getConnection(url, user, pwd);
} catch (SQLException e) { 

// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClassNotFoundException e) { 

// TODO Auto-generated catch block
e.printStackTrace();
}
return conn;
}
public static void closeConn(Connection conn, PreparedStatement ps, ResultSet rs){ 

if(conn!=null){ 

try { 

conn.close();
} catch (SQLException e) { 

// TODO Auto-generated catch block
e.printStackTrace();
}
}
if(ps!=null){ 

try { 

ps.close();
} catch (SQLException e) { 

// TODO Auto-generated catch block
e.printStackTrace();
}
}
if(rs!=null){ 

try { 

rs.close();
} catch (SQLException e) { 

// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}

WEB-INF包

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 
xmlns="http://java.sun.com/xml/ns/javaee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>Shop</display-name>
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>AddServlet</servlet-name>
<servlet-class>com.hnpi.servlet.AddServlet</servlet-class>
</servlet>
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>DeleteServlet</servlet-name>
<servlet-class>com.hnpi.servlet.DeleteServlet</servlet-class>
</servlet>
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>InsertServlet</servlet-name>
<servlet-class>com.hnpi.servlet.InsertServlet</servlet-class>
</servlet>
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>ListChoseServlet</servlet-name>
<servlet-class>com.hnpi.servlet.ListChoseServlet</servlet-class>
</servlet>
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>ListServlet</servlet-name>
<servlet-class>com.hnpi.servlet.ListServlet</servlet-class>
</servlet>
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>SelectServlet</servlet-name>
<servlet-class>com.hnpi.servlet.SelectServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AddServlet</servlet-name>
<url-pattern>/add</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>DeleteServlet</servlet-name>
<url-pattern>/del</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>InsertServlet</servlet-name>
<url-pattern>/insert</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ListChoseServlet</servlet-name>
<url-pattern>/listes</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ListServlet</servlet-name>
<url-pattern>/list</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SelectServlet</servlet-name>
<url-pattern>/select</url-pattern>
</servlet-mapping>	
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
</web-app>

JSP页面

index.jsp

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<ul>
<li><a href="index.jsp">系统管理</a></li>
<li><a href="list">商品管理</a></li>
</ul>
</body>
</html>

list.jsp

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.hnpi.bean.Product"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'list.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script src="jquery-3.3.1.js"></script>
</head>
<body>
<form action="listes" method="post">
商品名称:<input type="text" name="ProductName">
商品备注:<input type="text" name="Remark">
<input type="submit" value="查询">
</form>
<table>
<thead>
<tr>
<td>编号</td>
<td>商品名称</td>
<td>是否上架</td>
<td>单价</td>
<td>备注</td>
<td>操作</td>
</tr>
</thead>
<tbody>
<%
List<Product> products = (ArrayList)session.getAttribute("productList"); for(Product product : products){ 

%>
<tr>
<td><%=product.getProductID() %></td>
<td><%=product.getProductName() %></td>
<td><%=product.getIsUp() %></td>
<td><%=product.getUnitPrice() %></td>
<td><%=product.getRemark() %></td>
<td><a href="del?id=<%=product.getProductID() %>" class="delete">删除</a></td>
</tr>
<%
}
%> </tbody> </table> <form action="add" method="post"> 商品名称:<input type="text" name="ProductName"/> 是否上架:<input type="radio" name="IsUp"/>是<input type="radio" name="IsUp"/>否 单价:<input type="text" name="UnitPrice"/><br/> 备注:<input type="text" name="Remark"/><br/> <input type="submit" value="添加商品" class="add"/> </form> <button><a href="select">查看销售记录</a></button> </body> <script> $(function(){ 

$(".add").on("click",function(){ 

alert("添加成功!");
}); $(".delete").on("click",function(){ 

alert("你确定要删除吗?");
});
});
</script>
</html>

select.jsp

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.hnpi.bean.Sale"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'select.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script src="jquery-3.3.1.js"></script>
</head>
<body>
<form action="insert" method="post">
商品名称:<input type="text" name="SalePerson"/><br/>
销售数量:<input type="text" name="Amount"/>
销售员:<input type="text" name="SalePerson"/>
<input type="submit" value="添加销售" class="add"/>
</form>
<table>
<thead>
<tr>
<td>销售员</td>
<td>商品名称</td>
<td>单价</td>
<td>销售数量</td>
<td>销售日期</td>
</tr>
</thead>
<tbody>
<%
List<Sale> sales = (ArrayList)session.getAttribute("saleList"); for(Sale sale : sales){ 

%>
<tr>
<td><%=sale.getSaleID() %></td>
<td><%=sale.getSalePerson() %></td>
<td><%=sale.getProductID() %></td>
<td><%=sale.getAmount() %></td>
<td><%=sale.getSaleDate() %></td>
</tr>
<%
}
%> </tbody> </table> </body> <script> $(function(){ 

$(".add").on("click",function(){ 

alert("添加成功");
})
});
</script>
</html>

看到这里相信你已经知道此系统的程序原理了,赶快去试试吧.

扫一扫关注我的公众号获取更多资讯呦!!!
在这里插入图片描述

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/124762.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)
blank

相关推荐

  • 面试题的基本总结回顾(以以往面试过的问题做基本总结)[通俗易懂]

    Java基础问题整理:1.HashMap1.7与HashMap1.8的区别,从数据结构上、Hash值的计算上、链表数据的插入方法、内部Entry类的实现上分析?2.Hash1.7是基于数组和链表实现的,为什么不用双链表?HashMap1.8中引入红黑树的原因是?为什么要用红黑树而不是平衡二叉树?3.HashMap、HashTable、ConcurrentHashMap的原理与区别?…

  • The database disk image is malformed_数据库sqlite

    The database disk image is malformed_数据库sqlite一.问题分析此问题的提示也就是数据库文件损坏。如果在程序访问数据库期间拷贝是很容易出现该问题的,断开所有连接去拷贝在实际项目中有时候是不现实的,所以我们有时去做一下手动修复。二.问题修复1.下载sqlite3.exe到本地,并将损坏的数据库文件拷贝到同一个目录2.打开命令行工具(CMD),进入到sqlite3.exe所在目录3.使用sqlite3.exe打开损坏的数据库文件,并导出sql语句到临时文件E:\sqlite>sqlite3.exe2022_03_03

  • 武侠世界2-健壮性

    前几周就获得的武侠世界2的源代码,一直没有时间表去看。从网上搞来的武侠世界2的源代码,能编译通过,大的问题没有,小问题还是挺多。其它的细节,大家其实可以在网上搜索一下。下面的游戏运行的截图:我还把角色升到2级呢,废话少说,直奔主题。1、在windows下代码的健壮性打开World.sln,工程的main函数在World.cpp里面。开始部分我们能看到#ifdefined(…

  • Java课程设计——学生成绩管理系统

    Java课程设计——学生成绩管理系统Java课程设计题目:学生成绩管理系统摘要在现今信息时代,生活速度的加快,使得人们越来越向信息化、数字化发展。随着学校的规模不断扩大,学生数量急剧增加,有关学生的各种信息量也成倍增长,尤其是学生的考试成绩数据。面对庞大的学生的成绩,需要有学生成绩管理系统来提高学生管理工作的效率。介于此提出了学生成绩管理系统,学生管理系统是计算机对学生档案信息进行管理,具有手工管理无可比拟的优点,如索检迅速、查找方便、可靠性高、存储量大等有点。现在我国的大中专院校的学生成绩管理水平正在不断提高,停留在纸介质

  • SnackBar_冲洗器使用方法图解

    SnackBar_冲洗器使用方法图解我们在googlekeep中删除记事块儿时,下面会弹出一个小条儿,问你是否撤消,一段时间后自动隐去,同时右划也可以使它隐去。最初我以为这个小条儿是做的一个自定义控件,后来无意中发现不用这么麻烦。Go

  • 程序员法则_智脑黑客

    程序员法则_智脑黑客1.作为一个真正的程序员,首先应该尊重编程,热爱你所写下的程序,他是你的伙伴,而不是工具。2.程序员可以让步,却不可以退缩,可以羞涩,却不可以软弱,总之,程序员必须是勇敢的。3.编程是一种单调的生活,因此程序员比普通人需要更多的关怀,更多的友情。4.程序不是年轻的专利,但是,他属于年轻。5.没有情调,不懂浪漫,也许这是程序员的一面,但拥有朴实无华的爱是他们的另一面。6.一个好汉

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号