java中的JDBC用户管理系统_JDBC商品管理系统(有登录注册功能改进版)含个人注释和查看建好表代码的方法(二)...

在所有SQL语句的编译器中查看建好表代码的方法:ed3f6109e74fe961904c924d9fc8145d.png

4a18edcee3d4287dd8f31dbd7a3b42fe.png

8e35ee8c628729d396760a13c17d4264.png

1b867b34adcffc11a4662d9a51848e80.png

99fb768b5921deac7a571f2607775e54.png

310d74aa294ecca885e57efebbad5573.png

.java2ac9c54c78d496609df76eb383a8e0576.png

package JDBC;

public class shangpin {

private int sp_ID;

private String sp_Jieshao;

private String sp_Name;

private double sp_Price;

private sp_Type sp_TypeID;

public shangpin() {

}

public shangpin(int sp_ID, String sp_Name, double sp_Price,

sp_Type sp_TypeID, String sp_Jieshao) {

this.sp_ID = sp_ID;

this.sp_Name = sp_Name;

this.sp_Price = sp_Price;

this.sp_TypeID = sp_TypeID;

this.sp_Jieshao = sp_Jieshao;

}

public int getSp_ID() {

return sp_ID;

}

public String getSp_Jieshao() {

return sp_Jieshao;

}

public String getSp_Name() {

return sp_Name;

}

public double getSp_Price() {

return sp_Price;

}

public sp_Type getSp_TypeID() {

return sp_TypeID;

}

public void setSp_ID(int sp_ID) {

this.sp_ID = sp_ID;

}

public void setSp_Jieshao(String sp_Jieshao) {

this.sp_Jieshao = sp_Jieshao;

}

public void setSp_Name(String sp_Name) {

this.sp_Name = sp_Name;

}

public void setSp_Price(double sp_Price) {

this.sp_Price = sp_Price;

}

public void setSp_TypeID(sp_Type sp_TypeID) {

this.sp_TypeID = sp_TypeID;

}

@Override

public String toString() {

return "shangpin [sp_ID=" + sp_ID + ", sp_Name=" + sp_Name

+ ", sp_Price=" + sp_Price + ", sp_TypeID=" + sp_TypeID

+ ", sp_Jieshao=" + sp_Jieshao + "]";

}

}6b520996d1b7577acf066ed8141c1671.png

.java3514fcb1f98baa43b5463a4669e092253.png

37376f702e8ed73d72fad8affc2f1e0b.png

package JDBC;

public class sp_Type {

private int sp_TypeID;

private String sp_TypeName;

public sp_Type() {

}

public sp_Type(int sp_TypeID, String sp_TypeName) {

this.sp_TypeID = sp_TypeID;

this.sp_TypeName = sp_TypeName;

}

public int getSp_TypeID() {

return sp_TypeID;

}

public String getSp_TypeName() {

return sp_TypeName;

}

public void setSp_TypeID(int sp_TypeID) {

this.sp_TypeID = sp_TypeID;

}

public void setSp_TypeName(String sp_TypeName) {

this.sp_TypeName = sp_TypeName;

}

@Override

public String toString() {

return "sp_Type [sp_TypeID=" + sp_TypeID + ", sp_TypeName="

+ sp_TypeName + "]";

}

}6d91656f2b34ac0854d258b6fd948f1e.png

.java4c303fa2ac8d7c19b3afdce1fae3801f7.png

package JDBC;

public class yonghu {

private String yh_Address;// yh_Address代表用户地址

private int yh_Age;// 代表用户年龄

private int yh_ID;// 代表用户编号

private String yh_Jieshao;// 代表用户 个人介绍

private String yh_Name;// 代表用户 真实姓名

private String yh_Phone;// 代表用户 手机号

private String yh_Pwd;// 代表用户 登录密码

private String yh_Sex;// 代表用户 性别

private String yh_Uname;// 代表用户登录名

public String getYh_Address() {

return yh_Address;

}

public int getYh_Age() {

return yh_Age;

}

public int getYh_ID() {

return yh_ID;

}

public String getYh_Jieshao() {

return yh_Jieshao;

}

public String getYh_Name() {

return yh_Name;

}

public String getYh_Phone() {

return yh_Phone;

}

public String getYh_Pwd() {

return yh_Pwd;

}

public String getYh_Sex() {

return yh_Sex;

}

public String getYh_Uname() {

return yh_Uname;

}

public void setYh_Address(String yh_Address) {

this.yh_Address = yh_Address;

}

public void setYh_Age(int yh_Age) {

this.yh_Age = yh_Age;

}

public void setYh_ID(int yh_ID) {

this.yh_ID = yh_ID;

}

public void setYh_Jieshao(String yh_Jieshao) {

this.yh_Jieshao = yh_Jieshao;

}

public void setyh_Name(String string) {

}

public void setYh_Name(String yh_Name) {

this.yh_Name = yh_Name;

}

public void setYh_Phone(String yh_Phone) {

this.yh_Phone = yh_Phone;

}

public void setYh_Pwd(String yh_Pwd) {

this.yh_Pwd = yh_Pwd;

}

public void setYh_Sex(String yh_Sex) {

this.yh_Sex = yh_Sex;

}

public void setYh_Uname(String yh_Uname) {

this.yh_Uname = yh_Uname;

}

@Override

public String toString() {

return "yonghu [yh_ID=" + yh_ID + ", yh_Uname=" + yh_Uname

+ ", yh_Pwd=" + yh_Pwd + ", yh_Name=" + yh_Name + ", yh_Age="

+ yh_Age + ", yh_Sex=" + yh_Sex + ", yh_Phone=" + yh_Phone

+ ", yh_Address=" + yh_Address + ", yh_Jieshao=" + yh_Jieshao

+ "]";

}

}

226531912ade3cd414dceabcda969af0.png

.java5be85dbdcb4dec4085c8fb10a1ed61c07.png

package JDBC;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

public class diaoyongSQL {

private static Connection con = null;

private static ResultSet res = null;

private static Statement sta = null;

static {

try {

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");

} catch (ClassNotFoundException e) {

e.printStackTrace();

}

}

public static Connection getCon() {

if (con == null) {

try {

con = DriverManager.getConnection(

"jdbc:sqlserver://DESKTOP-49FTFSP;"

+ "databaseName=yonghu", "sa", "1234abcd");

} catch (SQLException e) {

e.printStackTrace();

}

}

return con;

}

public static ResultSet Select(String sql) {

con = getCon();

try {

sta = con.createStatement();

res = sta.executeQuery(sql);

} catch (SQLException e) {

e.printStackTrace();

}

return res;

}

public static boolean ZSG(String sql) {

boolean b = false;

con = getCon();

try {

sta = con.createStatement();

int num = sta.executeUpdate(sql);

if (num > 0) {

b = true;

}

} catch (SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

return b;

}

}

b27091a5db24ef3317b3f452343d5ab5.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值