当前位置: 首页 > news >正文

宁波网站制作首荐荣盛网络好/以下属于网站seo的内容是

宁波网站制作首荐荣盛网络好,以下属于网站seo的内容是,微信android平板版,网站制作中搜索栏怎么做1.简单的java ui界面 2.配合数据库创建了三个表 3.三个表分别是会员信息管理,优惠政策,商品信息 4.会员信息,优惠政策管理都实现了数据库的增,删,改,查。 5.物品信息表只实现了数据的查找 6.使用的软件版本…

1.简单的java ui界面
2.配合数据库创建了三个表
3.三个表分别是会员信息管理,优惠政策,商品信息
4.会员信息,优惠政策管理都实现了数据库的增,删,改,查。
5.物品信息表只实现了数据的查找
6.使用的软件版本是idea2018,sqlsever2019,应该也是兼容sqlsever2008r2

不会运行可以私信
先放两张运行截图吧
只是使用了一个类直接复制上去就能运行非常方便
在这里插入图片描述
在这里插入图片描述

package 超市会员管理系统;import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.*;
import java.util.Vector;public class caidan {JFrame win1=new JFrame("超市会员管理系统");JFrame win2=new JFrame("会员信息管理");JFrame win3=new JFrame("物品信息管理");JFrame win4=new JFrame("超市会员管理系统");JFrame win5=new JFrame("修改会员信息");JFrame win6=new JFrame("删除会员信息");JFrame win7=new JFrame("添加会员信息");JFrame win8=new JFrame("查询会员信息");JFrame win9=new JFrame("优惠管理");JFrame win10=new JFrame("优惠管理");JFrame win11=new JFrame("优惠管理");JFrame win12=new JFrame("优惠管理");JFrame win13=new JFrame("优惠管理");JButton btn1=new JButton("会员信息管理");JButton btn2=new JButton("物品信息管理");JButton btn3=new JButton("折扣信息管理");JButton btn4=new JButton("修改");JButton btn5=new JButton("添加");JButton btn6=new JButton("删除");JButton btn7=new JButton("返回");JButton btn8=new JButton("返回");JButton btn9=new JButton("返回");JButton btn10=new JButton("查询");JLabel label;public void win1(){win1.setLayout(null);win1.setVisible(true);win1.setBounds(500,500,600,400);btn1.setSize(140,40);btn1.setLocation(50,300);btn2.setSize(140,40);btn2.setLocation(200,300);btn3.setSize(140,40);btn3.setLocation(350,300);win1.add(btn1);win1.add(btn2);win1.add(btn3);btn1.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {win1.setVisible(false);win2();}});btn2.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {win1.setVisible(false);win3();}});btn3.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {win1.setVisible(false);win9();}});label=new JLabel();label.setText("欢迎超市会员管理系统");label.setLocation(190,60);label.setSize(500, 200);win1.add(label);}public void win2(){win2.setLayout(null);win2.setVisible(true);win2.setBounds(500,500,600,400);btn4.setSize(80,40);btn4.setLocation(10,300);btn5.setSize(80,40);btn5.setLocation(110,300);btn6.setSize(80,40);btn6.setLocation(210,300);btn7.setSize(80,40);btn7.setLocation(310,300);btn10.setSize(80,40);btn10.setLocation(410,300);win2.add(btn4);win2.add(btn5);win2.add(btn6);win2.add(btn7);win2.add(btn10);btn7.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {win2.setVisible(false);win1();}});btn4.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {win2.setVisible(false);win5();}});btn5.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {win2.setVisible(false);win7();}});btn6.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {win2.setVisible(false);win6();}});btn10.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {win2.setVisible(false);win8();}});
}
public void win3(){win3.setLayout(null);win3.setVisible(true);win3.setBounds(500,500,600,400);btn8.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {win3.setVisible(false);win1();}});JLabel lab1= new JLabel("需要查找物品编号");JLabel lab2= new JLabel("物品编号");JLabel lab3= new JLabel("物品名称");JLabel lab4= new JLabel("物品数量");JLabel lab5= new JLabel("物品价格");JTextField jtex1= new JTextField();JTextField jtex2= new JTextField();JTextField jtex3= new JTextField();JTextField jtex4= new JTextField();JTextField jtex5= new JTextField();lab1.setSize(80,30);lab1.setLocation(100,20);lab2.setSize(80,30);lab2.setLocation(100,70);lab3.setSize(80,30);lab3.setLocation(100,120);lab4.setSize(80,30);lab4.setLocation(100,170);lab5.setSize(80,30);lab5.setLocation(100,220);win3.add(lab1);win3.add(lab2);win3.add(lab3);win3.add(lab4);win3.add(lab5);jtex1.setSize(80,30);jtex1.setLocation(180,20);jtex2.setSize(80,30);jtex2.setLocation(180,70);jtex3.setSize(80,30);jtex3.setLocation(180,120);jtex4.setSize(80,30);jtex4.setLocation(180,170);jtex5.setSize(80,30);jtex5.setLocation(180,220);win3.add(jtex1);win3.add(jtex2);win3.add(jtex3);win3.add(jtex4);win3.add(jtex5);JButton bt1=new JButton("点击查找");JButton bt2=new JButton("点击返回");bt1.setSize(100,50);bt1.setLocation(400,100);bt2.setSize(100,50);bt2.setLocation(400,200);win3.add(bt1);win3.add(bt2);bt2.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {win3.setVisible(false);win1();}});bt1.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {String inputName=jtex1.getText();try {Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");//加载对应的jdbc驱动String url="jdbc:sqlserver://localhost:1433; DatabaseName=supermaket";//配置连接字符串String user="sa";//sa超级管理员String password="123";//密码Connection conn=DriverManager.getConnection(url,user,password);//创建数据库连接对象Statement st=conn.createStatement();//创建SQL语句执行对象String  strSQL="(Select* from  dbo.wupin where 物品编号='"+inputName+"' )";ResultSet rs=st.executeQuery(strSQL);if(rs.next()){jtex2.setText(rs.getString(1));jtex3.setText(rs.getString(2));jtex4.setText(rs.getString(3));jtex5.setText(rs.getString(4));}else{JOptionPane.showMessageDialog(null, "您查询的课程不存在,请重新输入");}conn.close();//关闭数据库连接}catch (ClassNotFoundException ex) {System.out.println("没有找到对应的数据库驱动类");}catch (SQLException ex) {System.out.println("数据库连接或者是数据库操作失败");}}});}
public void win4(){win4.setLayout(null);win4.setVisible(true);win4.setBounds(500,500,600,400);btn9.setSize(150,40);btn9.setLocation(225,300);win4.add(btn9);btn9.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {win4.setVisible(false);win1();}});
}
public void win5(){win5.setLayout(null);win5.setVisible(true);win5.setBounds(500,500,600,400);JLabel lab1= new JLabel("姓名");JLabel lab2= new JLabel("性别");JLabel lab3= new JLabel("年龄");JLabel lab4= new JLabel("联系方式");JLabel lab5= new JLabel("编号");JLabel lab6= new JLabel("需要修改的姓名");JTextField jtex1= new JTextField();JTextField jtex2= new JTextField();JTextField jtex3= new JTextField();JTextField jtex4= new JTextField();JTextField jtex5= new JTextField();JTextField jtex6= new JTextField();lab1.setSize(80,30);lab1.setLocation(100,70);lab2.setSize(80,30);lab2.setLocation(100,120);lab3.setSize(80,30);lab3.setLocation(100,170);lab4.setSize(80,30);lab4.setLocation(100,220);lab5.setSize(80,30);lab5.setLocation(100,270);lab6.setSize(80,30);lab6.setLocation(100,20);win5.add(lab1);win5.add(lab2);win5.add(lab3);win5.add(lab4);win5.add(lab5);win5.add(lab6);jtex1.setSize(80,30);jtex1.setLocation(180,70);jtex2.setSize(80,30);jtex2.setLocation(180,120);jtex3.setSize(80,30);jtex3.setLocation(180,170);jtex4.setSize(80,30);jtex4.setLocation(180,220);jtex5.setSize(80,30);jtex5.setLocation(180,270);jtex6.setSize(80,30);jtex6.setLocation(180,20);win5.add(jtex1);win5.add(jtex2);win5.add(jtex3);win5.add(jtex4);win5.add(jtex5);win5.add(jtex6);JButton bt1=new JButton("点击修改");JButton bt2=new JButton("点击返回");bt1.setSize(100,50);bt1.setLocation(400,100);bt2.setSize(100,50);bt2.setLocation(400,200);win5.add(bt1);win5.add(bt2);bt2.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {win5.setVisible(false);win2();}});bt1.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {String Name=jtex6.getText();String updateName=jtex1.getText();String sex=jtex2.getText();String age=jtex3.getText();String number=jtex4.getText();String id=jtex5.getText();try {Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");//加载对应的jdbc驱动String url="jdbc:sqlserver://localhost:1433; DatabaseName=supermaket";//配置连接字符串String user="sa";//sa超级管理员String password="123";//密码Connection conn=DriverManager.getConnection(url,user,password);//创建数据库连接对象Statement st=conn.createStatement();//创建SQL语句执行对象String  strSQL1="update dbo.huiyuan set 姓名='"+updateName+"' where 姓名='"+Name+"'";String  strSQL2="update dbo.huiyuan set 性别='"+sex+"' where 姓名='"+Name+"'";String  strSQL3="update dbo.huiyuan set 年龄='"+age+"' where 姓名='"+Name+"'";String  strSQL4="update dbo.huiyuan set 联系方式='"+number+"' where 姓名='"+Name+"'";String  strSQL5="update dbo.huiyuan set 会员编号='"+id+"' where 姓名='"+Name+"'";int rs1=st.executeUpdate(strSQL1);int rs2=st.executeUpdate(strSQL2);int rs3=st.executeUpdate(strSQL3);int rs4=st.executeUpdate(strSQL4);int rs5=st.executeUpdate(strSQL5);if(rs1==1||rs2==1||rs3==1||rs4==1||rs5==1) {JOptionPane.showMessageDialog(null,"修改成功");}else{JOptionPane.showMessageDialog(null,"修改失败");}conn.close();//关闭数据库连接}catch (ClassNotFoundException ex) {System.out.println("没有找到对应的数据库驱动类");}catch (SQLException ex) {System.out.println("数据库连接或者是数据库操作失败");}}});}public void win6(){win6.setLayout(null);win6.setVisible(true);win6.setBounds(500,500,600,400);JLabel lab1= new JLabel("姓名");JTextField jtex1= new JTextField();lab1.setSize(50,30);lab1.setLocation(100,70);win6.add(lab1);jtex1.setSize(80,30);jtex1.setLocation(180,70);win6.add(jtex1);JButton bt1=new JButton("点击删除");JButton bt2=new JButton("点击返回");bt1.setSize(100,50);bt1.setLocation(400,100);bt2.setSize(100,50);bt2.setLocation(400,200);win6.add(bt1);win6.add(bt2);bt2.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {win6.setVisible(false);win2();}});bt1.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {String delName=jtex1.getText();try {Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");//加载对应的jdbc驱动String url="jdbc:sqlserver://localhost:1433; DatabaseName=supermaket";//配置连接字符串String user="sa";//sa超级管理员String password="123";//密码Connection conn=DriverManager.getConnection(url,user,password);//创建数据库连接对象Statement st=conn.createStatement();//创建SQL语句执行对象String strSQL="delete from  dbo.huiyuan where 姓名='"+delName+"' ";int rs=st.executeUpdate(strSQL);if(rs==1) {JOptionPane.showMessageDialog(null,"删除成功");}else{JOptionPane.showMessageDialog(null,"删除失败");}conn.close();//关闭数据库连接}catch (ClassNotFoundException ex) {System.out.println("没有找到对应的数据库驱动类");}catch (SQLException ex) {System.out.println("数据库连接或者是数据库操作失败");}}});}
public void win7(){win7.setLayout(null);win7.setVisible(true);win7.setBounds(500,500,600,400);JLabel lab1= new JLabel("姓名");JLabel lab2= new JLabel("性别");JLabel lab3= new JLabel("年龄");JLabel lab4= new JLabel("联系方式");JLabel lab5= new JLabel("编号");JTextField jtex1= new JTextField();JTextField jtex2= new JTextField();JTextField jtex3= new JTextField();JTextField jtex4= new JTextField();JTextField jtex5= new JTextField();lab1.setSize(80,30);lab1.setLocation(100,70);lab2.setSize(80,30);lab2.setLocation(100,120);lab3.setSize(80,30);lab3.setLocation(100,170);lab4.setSize(80,30);lab4.setLocation(100,220);lab5.setSize(80,30);lab5.setLocation(100,270);win7.add(lab1);win7.add(lab2);win7.add(lab3);win7.add(lab4);win7.add(lab5);jtex1.setSize(80,30);jtex1.setLocation(180,70);jtex2.setSize(80,30);jtex2.setLocation(180,120);jtex3.setSize(80,30);jtex3.setLocation(180,170);jtex4.setSize(80,30);jtex4.setLocation(180,220);jtex5.setSize(80,30);jtex5.setLocation(180,270);win7.add(jtex1);win7.add(jtex2);win7.add(jtex3);win7.add(jtex4);win7.add(jtex5);JButton bt1=new JButton("点击添加");JButton bt2=new JButton("点击返回");bt1.setSize(100,50);bt1.setLocation(400,100);bt2.setSize(100,50);bt2.setLocation(400,200);win7.add(bt1);win7.add(bt2);bt2.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {win7.setVisible(false);win2();}});bt1.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {String addName=jtex1.getText();String addsex=jtex2.getText();String addage=jtex3.getText();String addnumber=jtex4.getText();String addid=jtex5.getText();try {Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");//加载对应的jdbc驱动String url="jdbc:sqlserver://localhost:1433; DatabaseName= supermaket";//配置连接字符串String user="sa";//sa超级管理员String password="123";//密码Connection conn=DriverManager.getConnection(url,user,password);//创建数据库连接对象Statement st=conn.createStatement();//创建SQL语句执行对象String  strSQL="insert into  dbo.huiyuan values('"+addName+"','"+addsex+"','"+addage+"','"+addnumber+"','"+addid+"')";int rs=st.executeUpdate(strSQL);if(rs==1) {JOptionPane.showMessageDialog(null,"添加成功");}else{JOptionPane.showMessageDialog(null,"添加失败");}conn.close();//关闭数据库连接}catch (ClassNotFoundException ex) {System.out.println("没有找到对应的数据库驱动类");}catch (SQLException ex) {System.out.println("数据库连接或者是数据库操作失败");}}});
}
public void win8(){win8.setLayout(null);win8.setVisible(true);win8.setBounds(500,500,600,400);JLabel lab1= new JLabel("需要查找的姓名");JLabel lab2= new JLabel("姓名");JLabel lab3= new JLabel("性别");JLabel lab4= new JLabel("年龄");JLabel lab5= new JLabel("联系方式");JLabel lab6= new JLabel("会员编号");JTextField jtex1= new JTextField();JTextField jtex2= new JTextField();JTextField jtex3= new JTextField();JTextField jtex4= new JTextField();JTextField jtex5= new JTextField();JTextField jtex6= new JTextField();lab1.setSize(80,30);lab1.setLocation(100,20);lab2.setSize(80,30);lab2.setLocation(100,70);lab3.setSize(80,30);lab3.setLocation(100,120);lab4.setSize(80,30);lab4.setLocation(100,170);lab5.setSize(80,30);lab5.setLocation(100,220);lab6.setSize(80,30);lab6.setLocation(100,270);win8.add(lab1);win8.add(lab2);win8.add(lab3);win8.add(lab4);win8.add(lab5);win8.add(lab6);jtex1.setSize(80,30);jtex1.setLocation(180,20);jtex2.setSize(80,30);jtex2.setLocation(180,70);jtex3.setSize(80,30);jtex3.setLocation(180,120);jtex4.setSize(80,30);jtex4.setLocation(180,170);jtex5.setSize(80,30);jtex5.setLocation(180,220);jtex6.setSize(80,30);jtex6.setLocation(180,270);win8.add(jtex1);win8.add(jtex2);win8.add(jtex3);win8.add(jtex4);win8.add(jtex5);win8.add(jtex6);JButton bt1=new JButton("点击查找");JButton bt2=new JButton("点击返回");bt1.setSize(100,50);bt1.setLocation(400,100);bt2.setSize(100,50);bt2.setLocation(400,200);win8.add(bt1);win8.add(bt2);bt2.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {win8.setVisible(false);win2();}});bt1.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {String inputName=jtex1.getText();try {Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");//加载对应的jdbc驱动String url="jdbc:sqlserver://localhost:1433; DatabaseName=supermaket";//配置连接字符串String user="sa";//sa超级管理员String password="123";//密码Connection conn=DriverManager.getConnection(url,user,password);//创建数据库连接对象Statement st=conn.createStatement();//创建SQL语句执行对象String  strSQL="(Select* from  dbo.huiyuan where 姓名='"+inputName+"' )";ResultSet rs=st.executeQuery(strSQL);if(rs.next()){jtex2.setText(rs.getString(1));jtex3.setText(rs.getString(2));jtex4.setText(rs.getString(3));jtex5.setText(rs.getString(4));jtex6.setText(rs.getString(5));}else{JOptionPane.showMessageDialog(null, "您查询的数据不存在,请重新输入");}conn.close();//关闭数据库连接}catch (ClassNotFoundException ex) {System.out.println("没有找到对应的数据库驱动类");}catch (SQLException ex) {System.out.println("数据库连接或者是数据库操作失败");}}});
}
public void win9(){win9.setLayout(null);win9.setVisible(true);win9.setBounds(500,500,600,400);JButton bt1=new JButton("查询");JButton bt2=new JButton("添加");JButton bt3=new JButton("修改");JButton bt4=new JButton("删除");JButton bt5=new JButton("返回");bt1.setSize(80,40);bt1.setLocation(10,300);bt2.setSize(80,40);bt2.setLocation(110,300);bt3.setSize(80,40);bt3.setLocation(210,300);bt4.setSize(80,40);bt4.setLocation(310,300);bt5.setSize(80,40);bt5.setLocation(410,300);win9.add(bt1);win9.add(bt2);win9.add(bt3);win9.add(bt4);win9.add(bt5);bt1.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {win9.setVisible(false);win10();}});bt2.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {win9.setVisible(false);win11();}});bt3.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {win9.setVisible(false);win12();}});bt4.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {win9.setVisible(false);win13();}});bt5.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {win9.setVisible(false);win1();}});}
public void win10(){win10.setLayout(null);win10.setVisible(true);win10.setBounds(500,500,600,400);JLabel lab1= new JLabel("需找编号");JLabel lab2= new JLabel("编号");JLabel lab3= new JLabel("积分");JLabel lab4= new JLabel("优惠政策");JTextField jtex1= new JTextField();JTextField jtex2= new JTextField();JTextField jtex3= new JTextField();JTextField jtex4= new JTextField();lab1.setSize(80,30);lab1.setLocation(100,20);lab2.setSize(80,30);lab2.setLocation(100,70);lab3.setSize(80,30);lab3.setLocation(100,120);lab4.setSize(80,30);lab4.setLocation(100,170);win10.add(lab1);win10.add(lab2);win10.add(lab3);win10.add(lab4);jtex1.setSize(80,30);jtex1.setLocation(180,20);jtex2.setSize(80,30);jtex2.setLocation(180,70);jtex3.setSize(80,30);jtex3.setLocation(180,120);jtex4.setSize(80,30);jtex4.setLocation(180,170);win10.add(jtex1);win10.add(jtex2);win10.add(jtex3);win10.add(jtex4);JButton bt1=new JButton("点击查找");JButton bt2=new JButton("点击返回");bt1.setSize(100,50);bt1.setLocation(400,100);bt2.setSize(100,50);bt2.setLocation(400,200);win10.add(bt1);win10.add(bt2);bt2.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {win10.setVisible(false);win9();}});bt1.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {String inputName=jtex1.getText();try {Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");//加载对应的jdbc驱动String url="jdbc:sqlserver://localhost:1433; DatabaseName=supermaket";//配置连接字符串String user="sa";//sa超级管理员String password="123";//密码Connection conn=DriverManager.getConnection(url,user,password);//创建数据库连接对象Statement st=conn.createStatement();//创建SQL语句执行对象String  strSQL="(Select* from  dbo.youhui where 会员编号='"+inputName+"' )";ResultSet rs=st.executeQuery(strSQL);if(rs.next()){jtex2.setText(rs.getString(1));jtex3.setText(rs.getString(2));jtex4.setText(rs.getString(3));}else{JOptionPane.showMessageDialog(null, "您查询的数据不存在,请重新输入");}conn.close();//关闭数据库连接}catch (ClassNotFoundException ex) {System.out.println("没有找到对应的数据库驱动类");}catch (SQLException ex) {System.out.println("数据库连接或者是数据库操作失败");}}});}
public void win11(){win11.setLayout(null);win11.setVisible(true);win11.setBounds(500,500,600,400);JLabel lab1= new JLabel("会员编号");JLabel lab2= new JLabel("会员积分");JLabel lab3= new JLabel("优惠政策");JTextField jtex1= new JTextField();JTextField jtex2= new JTextField();JTextField jtex3= new JTextField();lab1.setSize(80,30);lab1.setLocation(100,20);lab2.setSize(80,30);lab2.setLocation(100,70);lab3.setSize(80,30);lab3.setLocation(100,120);win11.add(lab1);win11.add(lab2);win11.add(lab3);jtex1.setSize(80,30);jtex1.setLocation(180,20);jtex2.setSize(80,30);jtex2.setLocation(180,70);jtex3.setSize(80,30);jtex3.setLocation(180,120);win11.add(jtex1);win11.add(jtex2);win11.add(jtex3);JButton bt1=new JButton("点击添加");JButton bt2=new JButton("点击返回");bt1.setSize(100,50);bt1.setLocation(400,100);bt2.setSize(100,50);bt2.setLocation(400,200);win11.add(bt1);win11.add(bt2);bt2.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {win11.setVisible(false);win9();}});bt1.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {String addid=jtex1.getText();String addnumber=jtex2.getText();String add=jtex3.getText();try {Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");//加载对应的jdbc驱动String url="jdbc:sqlserver://localhost:1433; DatabaseName= supermaket";//配置连接字符串String user="sa";//sa超级管理员String password="123";//密码Connection conn=DriverManager.getConnection(url,user,password);//创建数据库连接对象Statement st=conn.createStatement();//创建SQL语句执行对象String  strSQL="insert into  dbo.youhui values('"+addid+"','"+addnumber+"','"+add+"' )";int rs=st.executeUpdate(strSQL);if(rs==1) {JOptionPane.showMessageDialog(null,"添加成功");}else{JOptionPane.showMessageDialog(null,"添加失败");}conn.close();//关闭数据库连接}catch (ClassNotFoundException ex) {System.out.println("没有找到对应的数据库驱动类");}catch (SQLException ex) {System.out.println("数据库连接或者是数据库操作失败");}}});}public void win12(){win12.setLayout(null);win12.setVisible(true);win12.setBounds(500,500,600,400);JLabel lab1= new JLabel("需改编号");JLabel lab2= new JLabel("会员编号");JLabel lab3= new JLabel("会员积分");JLabel lab4= new JLabel("折扣");JTextField jtex1= new JTextField();JTextField jtex2= new JTextField();JTextField jtex3= new JTextField();JTextField jtex4= new JTextField();lab1.setSize(80,30);lab1.setLocation(100,70);lab2.setSize(80,30);lab2.setLocation(100,120);lab3.setSize(80,30);lab3.setLocation(100,170);lab4.setSize(80,30);lab4.setLocation(100,220);win12.add(lab1);win12.add(lab2);win12.add(lab3);win12.add(lab4);jtex1.setSize(80,30);jtex1.setLocation(180,70);jtex2.setSize(80,30);jtex2.setLocation(180,120);jtex3.setSize(80,30);jtex3.setLocation(180,170);jtex4.setSize(80,30);jtex4.setLocation(180,220);win12.add(jtex1);win12.add(jtex2);win12.add(jtex3);win12.add(jtex4);JButton bt1=new JButton("点击修改");JButton bt2=new JButton("点击返回");bt1.setSize(100,50);bt1.setLocation(400,100);bt2.setSize(100,50);bt2.setLocation(400,200);win12.add(bt1);win12.add(bt2);bt2.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {win12.setVisible(false);win9();}});bt1.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {String id=jtex1.getText();String updateid=jtex2.getText();String updatenumber=jtex3.getText();String update=jtex4.getText();try {Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");//加载对应的jdbc驱动String url="jdbc:sqlserver://localhost:1433; DatabaseName=supermaket";//配置连接字符串String user="sa";//sa超级管理员String password="123";//密码Connection conn=DriverManager.getConnection(url,user,password);//创建数据库连接对象Statement st=conn.createStatement();//创建SQL语句执行对象String  strSQL1="update dbo.youhui set 会员编号='"+updateid+"' where 会员编号='"+id+"'";String  strSQL2="update dbo.youhui set 会员积分='"+updatenumber+"' where 会员编号='"+id+"'";String  strSQL3="update dbo.youhui set 优惠政策='"+update+"' where 会员编号='"+id+"'";int rs1=st.executeUpdate(strSQL1);int rs2=st.executeUpdate(strSQL2);int rs3=st.executeUpdate(strSQL3);if(rs1==1||rs2==1||rs3==1) {JOptionPane.showMessageDialog(null,"修改成功");}else{JOptionPane.showMessageDialog(null,"修改失败");}conn.close();//关闭数据库连接}catch (ClassNotFoundException ex) {System.out.println("没有找到对应的数据库驱动类");}catch (SQLException ex) {System.out.println("数据库连接或者是数据库操作失败");}}});}public void win13(){win13.setLayout(null);win13.setVisible(true);win13.setBounds(500,500,600,400);JLabel lab1= new JLabel("会员编号");JTextField jtex1= new JTextField();lab1.setSize(50,30);lab1.setLocation(100,70);win13.add(lab1);jtex1.setSize(80,30);jtex1.setLocation(180,70);win13.add(jtex1);JButton bt1=new JButton("点击删除");JButton bt2=new JButton("点击返回");bt1.setSize(100,50);bt1.setLocation(400,100);bt2.setSize(100,50);bt2.setLocation(400,200);win13.add(bt1);win13.add(bt2);bt2.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {win13.setVisible(false);win9();}});bt1.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {String delid=jtex1.getText();try {Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");//加载对应的jdbc驱动String url="jdbc:sqlserver://localhost:1433; DatabaseName=supermaket";//配置连接字符串String user="sa";//sa超级管理员String password="123";//密码Connection conn=DriverManager.getConnection(url,user,password);//创建数据库连接对象Statement st=conn.createStatement();//创建SQL语句执行对象String strSQL="delete from  dbo.youhui where 会员编号='"+delid+"' ";int rs=st.executeUpdate(strSQL);if(rs==1) {JOptionPane.showMessageDialog(null,"删除成功");}else{JOptionPane.showMessageDialog(null,"删除失败");}conn.close();//关闭数据库连接}catch (ClassNotFoundException ex) {System.out.println("没有找到对应的数据库驱动类");}catch (SQLException ex) {System.out.println("数据库连接或者是数据库操作失败");}}});
}public static void main(String[] args) {caidan caidan=new caidan();caidan.win1();;}
}
http://www.lbrq.cn/news/1440127.html

相关文章:

  • 设计素材网站上的素材可以商用吗/成都高新seo
  • 公司网站建设需求书/人民日报今日新闻
  • 帝国做网站是选择静态还是伪静态/建站系统源码
  • b2b电子商务平台登录/女装标题优化关键词
  • 手机网站建设服务电话/360优化大师官方下载手机
  • 网站建设实施/能让网络非常流畅的软件
  • 温州知名网站推广/站长工具网站
  • 游戏网站上做银商为赌博人员/成都比较靠谱的seo
  • 做网站推广每天加班/站长工具官网域名查询
  • wordpress 做购物网站/百度知道灰色词代发收录
  • 男朋友说是做竞彩网站维护的/b站引流推广网站
  • 建设景区网站推文/整合营销策略
  • 亿网行网站建设/网络优化工程师有前途吗
  • 网站为什么维护/朝阳区seo搜索引擎优化怎么样
  • wordpress nextgen gallery/网站seo提升
  • wordpress响应多少才正常/兰州seo优化
  • 太原网站优化教程/百度网站首页提交入口
  • 企业网站建设 建立作用/做网站企业
  • 合肥专业网站建设/简述如何对网站进行推广
  • 石家庄上门足疗/网站seo优化方案
  • 深圳网络seo优化/网站需要怎么优化比较好
  • 品牌网站建设仁術大蝌蚪/百度seo官方网站
  • 观澜网站建设/网站seo优化运营
  • 什么网站可以做实验室/精准ip地址查询工具
  • 抖音小程序推广怎么挂才有收益/哈尔滨关键词优化报价
  • 柳州网站建设33/大地seo视频
  • 辽宁城乡建设工程招标网(官网)/网站seo关键词优化技巧
  • 企业网站开发需要多钱/百度ocpc如何优化
  • 免费的ppt网站推荐/如何建立网页
  • 计算机专业网站建设实训日志/网站seo入门基础教程
  • Spring Boot项目调用第三方接口的三种方式比较
  • Linux 软件编程:文件IO、目录IO、时间函数
  • HiSmartPerf使用WIFI方式连接Android机显示当前设备0.0.0.0无法ping通!设备和电脑连接同一网络,将设备保持亮屏重新尝试
  • 【H5】禁止IOS、安卓端长按的一些默认操作
  • 【自动化备份全网服务器数据项目】
  • 数据结构:中缀到后缀的转换(Infix to Postfix Conversion)