JAVA+Mysql实现图形化客户信息管理系统

JAVA程序设计期末大作业仅供参考

正文:基于java和MySQL实现客户信息管理系统,通过JDBC实现对客户信息的增删改查
test.java:主类负责生成一个登陆界面的窗口
LoginWin.java:登陆注册菜单窗口
MainWin.java:增删改查的主界面
ZhuCe.java:注册界面
DengLu.java:登录窗口
GetDBConnection:链接mysql
ZengJia.java:增加客户信息
ShanChu.java:删除客户信息(删除主键)
GengGai.java:更改客户信息(先判断要删除的客户id是否存在)
GengGaixinxi.java:更改客户信息的界面
ChaXun.java:查询客户信息的界面
数据库名:客户信息管理系统
数据库字符集:gb2312
数据库排序规则:gb2312_chinese_ci
表cims:登录界面用的,字段是account和password
在这里插入图片描述

表ci:里面是客户信息,字段是id,name,level,telephone(level默认是1)
在这里插入图片描述

使用的JDBC链接器是:mysql-connector-java-8.0.15.jar

package 客户管理系统;

import java.sql.*;
public class GetDBConnection {
	public static Connection connectDB(String DBName, String user, String password) {
		Connection con = null;
		String uri="jdbc:mysql://127.0.0.1:3306/"+DBName+"?useSSL=false&serverTimezone=CST&characterEncoding=utf-8";
		try{ //加载JDBC-MySQL8.0.22连接器;
		Class.forName("com.mysql.cj.jdbc.Driver");
		}
		catch(Exception e){}
		try{ con=DriverManager.getConnection(uri,user,password);//连接
		}
		catch(SQLException e) {}
		return con;
	}
}

LoginWin.java:登陆注册菜单窗口:

DengLu.java:登录窗口:
![在这里插入图片描述](https://img-blog.csdnimg.cn/523413abbde547f1aafef31c096d6de9.png

ZhuCe.java:注册界面
在这里插入图片描述

MainWin.java:增删改查的主界面
在这里插入图片描述

ZengJia.java:增加客户信息
在这里插入图片描述

ShanChu.java:删除客户信息(删除主键)
在这里插入图片描述

GengGai.java:更改客户信息(先判断要删除的客户id是否存在)
在这里插入图片描述

GengGaixinxi.java:更改客户信息的界面
在这里插入图片描述

ChaXun.java:查询客户信息的界面
在这里插入图片描述

package 客户管理系统;
public class test {

	public static void main(String[] args) {
		LoginWin lg=new LoginWin();
	}

}

package 客户管理系统;
import javax.swing.*;
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
public class LoginWin extends JFrame implements ActionListener {
	JMenuBar menubar;
	JMenu admin;
	JMenuItem a,b;
	public LoginWin(){
		menubar=new JMenuBar();
		admin=new JMenu("登陆注册菜单");
		a=new JMenuItem("登录");
		b=new JMenuItem("注册");
		admin.add(a);
		admin.add(b);
		menubar.add(admin);
		setJMenuBar(menubar);
		a.addActionListener(this);
		b.addActionListener(this);
		setVisible(true);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setTitle("客户信息管理系统");
		setBounds(550,350,300,150);
		}
	public void actionPerformed(ActionEvent e) {
		if(e.getSource()==a) 
		{
			new DengLu();
			dispose();
		}
		if(e.getSource()==b)
		{
			new ZhuCe();
			dispose();
		}
	}
}

package 客户管理系统;
import javax.swing.*;
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
public class MainWin extends JFrame implements ActionListener{
	JButton button1,button2,button3,button4,button5;
	public MainWin() {
		setLayout(new FlowLayout());
		button1=new JButton("增加客户信息");
		button2=new JButton("删除客户信息");
		button3=new JButton("更改客户信息");
		button4=new JButton("查询客户信息");
		button5=new JButton("返回");
		add(button1);
		add(button2);
		add(button3);
		add(button4);
		add(button5);
		button1.addActionListener(this);
		button2.addActionListener(this);
		button3.addActionListener(this);
		button4.addActionListener(this);
		button5.addActionListener(this);
		setVisible(true);
		setTitle("主菜单");
		setBounds(550,350,310,260);
	}
	public void actionPerformed(ActionEvent e) {
		if(e.getSource()==button1) 
		{
			new ZengJia();
			dispose();
		}
		else if(e.getSource()==button2) 
		{
			new ShanChu();
			dispose();
		}
		else if(e.getSource()==button3) 
		{
			new GengGai();
			dispose();
		}   
		else if(e.getSource()==button4)
		{
			new ChaXun();
			dispose();
		}
		else if(e.getSource()==button5)
		{
			new LoginWin();
			dispose();
		}
	}
}

package 客户管理系统;
import javax.swing.*;
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
public class ZhuCe extends JFrame implements ActionListener {
	JTextField name,password1,password2;
	JButton button1,button2;
	Box boxone,boxtwo,boxthree;
	Box boxH1,boxH2,boxH3,boxH4,boxH5,boxend;
	public ZhuCe(){
		setLayout(new FlowLayout());
		boxH1=Box.createHorizontalBox();
		boxH2=Box.createHorizontalBox();
		boxH3=Box.createHorizontalBox();
		boxH4=Box.createHorizontalBox();
		boxH5=Box.createHorizontalBox();
		boxend=Box.createHorizontalBox();
		boxone=Box.createVerticalBox();
		boxtwo=Box.createVerticalBox();
		boxthree=Box.createVerticalBox();
		name=new JTextField(10);
		password1=new JTextField(10);
		password2=new JTextField(10);
		button1=new JButton("注册");
		button2=new JButton("取消");
		boxone.add(new JLabel("账号"));
		boxtwo.add(new JLabel("密码"));
		boxthree.add(new JLabel("密码"));
		boxH1.add(boxone);
		boxH2.add(name);
		boxH3.add(boxtwo);
		boxH4.add(password1);
		boxH5.add(boxthree);
		boxend.add(password2);
		add(boxH1);
		add(boxH2);
		add(boxH3);
		add(boxH4);
		add(boxH5);
		add(boxend);
		add(button1);
		add(button2);
		name.addActionListener(this);
		password1.addActionListener(this);
		password2.addActionListener(this);
		button1.addActionListener(this);
		button2.addActionListener(this);
		setVisible(true);
		setTitle("注册");
		setBounds(550,350,450,188);
	}
	public void actionPerformed(ActionEvent e) {
		Connection con=null;
		Statement sql;
		ResultSet rs;
		con=GetDBConnection.connectDB("客户信息管理系统","root","");
		if(con==null)
			return ;
		if(e.getSource()==button1)
		{
			if(name.getText().trim().equals("")) 
			{
				JOptionPane.showMessageDialog(this,"用户名不能为空");
			    name.requestFocusInWindow();
			}
			else if(password1.getText().trim().equals("")) 
		    {
			    JOptionPane.showMessageDialog(this,"密码不能为空");
		        password1.requestFocusInWindow();
		    }
			else if(password2.getText().trim().equals("")) 
			{
				JOptionPane.showMessageDialog(this,"请再输入一次密码");
			    password2.requestFocusInWindow();
			}
			else if(password1.getText().trim().equals(password2.getText().trim()))
			{
				try 
				{
					sql=con.createStatement();
					String jilu="('"+name.getText().trim()+"','"+password1.getText().trim()+"')";
					String sqlStr="insert into cims values"+jilu;
					int ok=sql.executeUpdate(sqlStr);
					JOptionPane.showMessageDialog(this,"注册成功");
					dispose();
					new DengLu();
				}
				catch(SQLException e1) 
				{
					JOptionPane.showMessageDialog(this,"注册失败");
				}
			}
			else
			{
				JOptionPane.showMessageDialog(this, "两次输入密码不一致");
			}
		}
		else if(e.getSource()==button2)
		{
			System.exit(0);
		}
	}

}


```java
package 客户管理系统;
import javax.swing.*;
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
public class DengLu extends JFrame implements ActionListener {
	JTextField name;
	JPasswordField password;
	JButton button1,button2;
	Box boxone,boxtwo;
	Box boxH1,boxH2,boxH3,boxH4;
	public DengLu(){
		setLayout(new FlowLayout());
		boxH1=Box.createHorizontalBox();
		boxH2=Box.createHorizontalBox();
		boxH3=Box.createHorizontalBox();
		boxH4=Box.createHorizontalBox();
		boxone=Box.createVerticalBox();
		boxtwo=Box.createVerticalBox();
		name=new JTextField(10);
		password=new JPasswordField(10);
		button1=new JButton("登录");
		button2=new JButton("取消");
		boxone.add(new JLabel("账号"));
		boxtwo.add(new JLabel("密码"));
		boxH1.add(boxone);
		boxH2.add(name);
		boxH3.add(boxtwo);
		boxH4.add(password);
		add(boxH1);
		add(boxH2);
		add(boxH3);
		add(boxH4);
		add(button1);
		add(button2);
		name.addActionListener(this);
		password.addActionListener(this);
		button1.addActionListener(this);
		button2.addActionListener(this);
		setVisible(true);
		setTitle("登录");
		setBounds(550,350,310,260);
	}
	public void actionPerformed(ActionEvent e) {
		Connection con=null;
		Statement sql;
		ResultSet rs;
		con=GetDBConnection.connectDB("客户信息管理系统","root","");
		if(con==null)
			return ;
		if(e.getSource()==button1) 
		{
			if(name.getText().trim().equals("")) 
			{
				JOptionPane.showMessageDialog(this, "用户名不能为空");
				name.requestFocusInWindow();
			}
			else if(new String(password.getPassword()).trim().equals("")) 
			{
				JOptionPane.showMessageDialog(this, "密码不能为空");
				password.requestFocusInWindow();
			}
			else 
			{
				try 
				{
					sql=con.createStatement();//创建一个statement的对象;statement对象是数据库sql语句的载体,通过statement对象可以执行数据库访问的sql语句;使用statement对象执行insert、update、delete语句是调用executeUpdate()方法。
					rs=sql.executeQuery("select * from cims where account= '"+name.getText().trim()+"'  and password= '"+new String(password.getPassword()).trim()+"'");
					if(rs.next()) 
					{
						JOptionPane.showMessageDialog(this, "用户名密码正确,登陆成功");
						new MainWin();
						dispose();
					}
					else 
					{
						JOptionPane.showMessageDialog(this, "用户名密码错误,登陆失败");
					}
				}
				catch(SQLException e2) 
				{
				}
			}
		}
		else if(e.getSource()==button2)
		{
			new LoginWin();
			dispose();
		}
	}
}

package 客户管理系统;
import javax.swing.*;
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
public class ZengJia extends JFrame implements ActionListener {
	JTextField text1,text2,text3,text4;
	Box boxone,boxtwo;
	Box boxH;
	JButton button1,button2;
	public ZengJia() {
		setLayout(new FlowLayout());
		boxH=Box.createHorizontalBox();
		boxone=Box.createVerticalBox();
		boxtwo=Box.createVerticalBox();
		button1=new JButton("增加");
		button2=new JButton("取消");
		button1.addActionListener(this);
		button2.addActionListener(this);
		boxone.add(new JLabel("客户编号"));
		boxone.add(Box.createVerticalStrut(10));
		boxone.add(new JLabel("客户姓名"));
		boxone.add(Box.createVerticalStrut(10));
		boxone.add(new JLabel("客户等级"));
		boxone.add(Box.createVerticalStrut(10));
		boxone.add(new JLabel("客户电话"));
		boxone.add(Box.createVerticalStrut(10));
		text1=new JTextField(10);
		text2=new JTextField(10);
		text3=new JTextField(10);
		text4=new JTextField(10);
		text1.addActionListener(this);
		text2.addActionListener(this);
		text3.addActionListener(this);
		text4.addActionListener(this);
		boxtwo.add(text1);
		boxtwo.add(Box.createVerticalStrut(10));
		boxtwo.add(text2);
		boxtwo.add(Box.createVerticalStrut(10));
		boxtwo.add(text3);
		boxtwo.add(Box.createVerticalStrut(10));
		boxtwo.add(text4);
		boxtwo.add(Box.createVerticalStrut(10));
		boxH.add(boxone);
		boxH.add(Box.createVerticalStrut(10));
		boxH.add(boxtwo);
		add(boxH);
		add(button1);
		add(button2);
		setVisible(true);
		setTitle("增加客户信息");
		setBounds(550,350,310,260);
	}
	public void actionPerformed(ActionEvent e) {//重写actionEvent接口
		Connection con=null;//数据库连接置空
		Statement sql;//Statement 是 Java 执行数据库操作的一个重要接口,用于在已经建立数据库连接的基础上,向数据库发送要执行的SQL语句
		ResultSet rs;//结果集(ResultSet)是数据中查询结果返回的一种对象,可以说结果集是一个存储查询结果的对象,但是结果集并不仅仅具有存储的功能,他同时还具有操纵数据的功能,可能完成对数据的更新等。 
		con=GetDBConnection.connectDB("客户信息管理系统","root","");
		if(con==null)
			return ;
		if(e.getSource()==button1)
		{

			if(text1.getText().trim().equals("")) 
			{
				JOptionPane.showMessageDialog(this,"客户编号不能为空");
			    text1.requestFocusInWindow();
			}
			else if(text2.getText().trim().equals("")) 
		    {
			    JOptionPane.showMessageDialog(this,"客户姓名不能为空");
		        text2.requestFocusInWindow();
		    }
			else if(text4.getText().trim().equals("")) 
		    {
			    JOptionPane.showMessageDialog(this,"客户电话不能为空");
		        text4.requestFocusInWindow();
		    }
			else
			{
				try 
				{
					sql=con.createStatement();
					String jilu="('"+text1.getText().trim()+"','"+text2.getText().trim()+"','"+text1.getText().trim()+"','"+text1.getText().trim()+"')";
					String sqlStr="insert into ci values"+jilu;
					int ok=sql.executeUpdate(sqlStr);//运行sqlstr中的sql语句
					JOptionPane.showMessageDialog(this,"添加成功");
					dispose();
					new MainWin();
				}
				catch(SQLException e1) 
				{
					JOptionPane.showMessageDialog(this,"添加失败");
				}
			}
		}
		else if(e.getSource()==button2)
		{
			new MainWin();
			dispose();
		}
		
	}
		

}

package 客户管理系统;
import javax.swing.*;
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
public class ShanChu extends JFrame implements ActionListener {
	JTextField text1;
	Box boxone,boxtwo;
	Box boxH;
	JButton button1,button2;
	public ShanChu() {
		setLayout(new FlowLayout());
		boxH=Box.createHorizontalBox();
		boxone=Box.createVerticalBox();
		boxtwo=Box.createVerticalBox();
		button1=new JButton("删除");
		button2=new JButton("取消");
		button1.addActionListener(this);
		button2.addActionListener(this);
		boxone.add(new JLabel("客户编号"));
		boxone.add(Box.createVerticalStrut(10));
		text1=new JTextField(10);
		text1.addActionListener(this);
		boxtwo.add(text1);
		boxtwo.add(Box.createVerticalStrut(10));
		boxH.add(boxone);
		boxH.add(Box.createVerticalStrut(10));
		boxH.add(Box.createHorizontalStrut(10));
		boxH.add(boxtwo);
		add(boxH);
		add(button1);
		add(button2);
		setVisible(true);
		setTitle("删除客户信息");
		setBounds(550,350,330,260);
	}
	public void actionPerformed(ActionEvent e) {
		Connection con=null;
		Statement sql;
		con=GetDBConnection.connectDB("客户信息管理系统","root","");
		if(con==null)
			return ;
		if(e.getSource()==button1)
		{
			if(text1.getText().trim().equals("")) 
			{
				JOptionPane.showMessageDialog(this,"客户编号不能为空");
			    text1.requestFocusInWindow();
			}
			else
			{
				try 
				{
					sql=con.createStatement();
					String jilu="('"+text1.getText().trim()+"')";
					String sqlStr="delete from ci where id="+jilu;
					int ok=sql.executeUpdate(sqlStr);
					JOptionPane.showMessageDialog(this,"删除成功");
					dispose();
					new ShanChu();
				}
				catch(SQLException e1) 
				{
					JOptionPane.showMessageDialog(this,"删除失败");
				}
			}
		}

			
		else if(e.getSource()==button2)
		{
			new MainWin();
			dispose();
		}
		
	}
}

package 客户管理系统;
import javax.swing.*;
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
public class GengGai extends JFrame implements ActionListener{
	private static final boolean True = false;
	JTextField text1,text2,text3,text4;
	Box boxone,boxtwo;
	Box boxH;
	JButton button1,button2;
	public GengGai() {
			setLayout(new FlowLayout());
			boxH=Box.createHorizontalBox();
			boxone=Box.createVerticalBox();
			boxtwo=Box.createVerticalBox();
			button1=new JButton("更改");
			button2=new JButton("取消");
			text1=new JTextField(10);
			text2=new JTextField(10);
			text3=new JTextField(10);
			text4=new JTextField(10);
			text1.addActionListener(this);
			text2.addActionListener(this);
			text3.addActionListener(this);
			text4.addActionListener(this);
			button1.addActionListener(this);
			button2.addActionListener(this);
			boxone.add(new JLabel("客户编号"));
			boxone.add(Box.createVerticalStrut(10));
			text1=new JTextField(10);
			text1.addActionListener(this);
			boxtwo.add(text1);
			boxtwo.add(Box.createVerticalStrut(10));
			boxH.add(boxone);
			boxH.add(Box.createVerticalStrut(10));
			boxH.add(Box.createHorizontalStrut(10));
			boxH.add(boxtwo);
			add(boxH);
			add(button1);
			add(button2);
			setVisible(true);
			setTitle("更改客户信息");
			setBounds(550,350,330,260);
	}
	public void actionPerformed(ActionEvent e) {
		Connection con=null;
		Statement sql;
		ResultSet rs;
		String a,b;
		con=GetDBConnection.connectDB("客户信息管理系统","root","");
		if(con==null)
			return ;
		if(e.getSource()==button1)
		{
			if(text1.getText().trim().equals("")) 
			{
				JOptionPane.showMessageDialog(this,"客户编号不能为空");
			    text1.requestFocusInWindow();
			}
			else
			{
				try 
				{
					b=text1.getText().trim();
					sql=con.createStatement();
					String jilu="('"+text1.getText().trim()+"')";
					String sqlStr="select id from ci where id="+jilu;
					rs=sql.executeQuery(sqlStr);
					rs.next();
					a=rs.getString(1);
					JOptionPane.showMessageDialog(this,"是否更改客户信息");
					if((a==b)==True) 
					{
						new GengGaixinxi();
						dispose();
					}
				}
				catch(SQLException e1) 
				{
					JOptionPane.showMessageDialog(this,"更改失败");
				}
			}
		}
		else if(e.getSource()==button2)
		{
			new MainWin();
			dispose();
		}
		
	}

}

package 客户管理系统;
import javax.swing.*;
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
public class GengGaixinxi extends JFrame implements ActionListener{
	JTextField text1,text2,text3,text4;
	Box boxone,boxtwo;
	Box boxH;
	JButton button1,button2;
	public GengGaixinxi() {
		setLayout(new FlowLayout());
		boxH=Box.createHorizontalBox();
		boxone=Box.createVerticalBox();
		boxtwo=Box.createVerticalBox();
		button1=new JButton("更改");
		button2=new JButton("取消");
		button1.addActionListener(this);
		button2.addActionListener(this);
		boxone.add(new JLabel("客户编号"));
		boxone.add(Box.createVerticalStrut(10));
		boxone.add(new JLabel("客户姓名"));
		boxone.add(Box.createVerticalStrut(10));
		boxone.add(new JLabel("客户等级"));
		boxone.add(Box.createVerticalStrut(10));
		boxone.add(new JLabel("客户电话"));
		boxone.add(Box.createVerticalStrut(10));
		text1=new JTextField(10);
		text2=new JTextField(10);
		text3=new JTextField(10);
		text4=new JTextField(10);
		text1.addActionListener(this);
		text2.addActionListener(this);
		text3.addActionListener(this);
		text4.addActionListener(this);
		boxtwo.add(text1);
		boxtwo.add(Box.createVerticalStrut(10));
		boxtwo.add(text2);
		boxtwo.add(Box.createVerticalStrut(10));
		boxtwo.add(text3);
		boxtwo.add(Box.createVerticalStrut(10));
		boxtwo.add(text4);
		boxtwo.add(Box.createVerticalStrut(10));
		boxH.add(boxone);
		boxH.add(Box.createVerticalStrut(10));
		boxH.add(boxtwo);
		add(boxH);
		add(button1);
		add(button2);
		setVisible(true);
		setTitle("更改客户信息");
		setBounds(550,350,310,260);
	}
	public void actionPerformed(ActionEvent e) {
		Connection con=null;
		Statement sql;
		ResultSet rs;
		con=GetDBConnection.connectDB("客户信息管理系统","root","");
		if(con==null)
			return ;
		if(e.getSource()==button1)
		{

			if(text1.getText().trim().equals("")) 
			{
				JOptionPane.showMessageDialog(this,"客户编号不能为空");
			    text1.requestFocusInWindow();
			}
			else if(text2.getText().trim().equals("")) 
		    {
			    JOptionPane.showMessageDialog(this,"客户姓名不能为空");
		        text2.requestFocusInWindow();
		    }
			else if(text4.getText().trim().equals("")) 
		    {
			    JOptionPane.showMessageDialog(this,"客户电话不能为空");
		        text4.requestFocusInWindow();
		    }
			else
			{
				try 
				{
					sql=con.createStatement();
					String jilu="('"+text1.getText().trim()+"')";
					String sqlStr="delete from ci where id="+jilu;
					int ok=sql.executeUpdate(sqlStr);
					String jilu2="('"+text1.getText().trim()+"','"+text2.getText().trim()+"','"+text3.getText().trim()+"','"+text4.getText().trim()+"')";
					String sqlStr1="insert into ci values"+jilu2;
					int ok1=sql.executeUpdate(sqlStr1);
					JOptionPane.showMessageDialog(this,"更改成功");
					dispose();
					new MainWin();
				}
				catch(SQLException e1) 
				{
					JOptionPane.showMessageDialog(this,"更改失败");
				}
			}
		}
		else if(e.getSource()==button2)
		{
			new MainWin();
			dispose();
		}
	}

}


package 客户管理系统;
import javax.swing.*;
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
public class ChaXun extends JFrame implements ActionListener {
	private static final boolean True = false;
	JTextArea text;
	JTextField text1;
	Box boxone,boxtwo;
	Box boxH;
	JButton button1,button2;
	public ChaXun() {
		text=new JTextArea(9,30);
		setLayout(new FlowLayout());
		boxH=Box.createHorizontalBox();
		boxone=Box.createVerticalBox();
		boxtwo=Box.createVerticalBox();
		button1=new JButton("查询");
		button2=new JButton("取消");
		button1.addActionListener(this);
		button2.addActionListener(this);
		boxone.add(new JLabel("客户编号"));
		boxone.add(Box.createVerticalStrut(10));
		text1=new JTextField(10);
		text1.addActionListener(this);
		boxtwo.add(text1);
		boxtwo.add(Box.createVerticalStrut(10));
		boxH.add(boxone);
		boxH.add(Box.createVerticalStrut(10));
		boxH.add(Box.createHorizontalStrut(10));
		boxH.add(boxtwo);
		add(boxH);
		add(button1);
		add(button2);
		add(text);
		setVisible(true);
		setTitle("查询客户信息");
		setBounds(550,350,330,260);
	}
	public void actionPerformed(ActionEvent e) {
		Connection con=null;
		Statement sql;
		ResultSet rs;
		String a,b,c,d;
		con=GetDBConnection.connectDB("客户信息管理系统","root","");
		if(con==null)
			return ;
		if(e.getSource()==button1)
		{
			if(text1.getText().trim().equals("")) 
			{
				JOptionPane.showMessageDialog(this,"客户编号不能为空");
			    text1.requestFocusInWindow();
			}
			else
			{
				try 
				{
					sql=con.createStatement();
					String jilu="('"+text1.getText().trim()+"')";
					String sqlStr="select * from ci where id="+jilu;
					rs=sql.executeQuery(sqlStr);
					rs.next();
					a=rs.getString(1);
					if(a!=null) 
					{
						b=rs.getString(2);
						c=rs.getString(3);
						d=rs.getString(4);
						String a1="客户编号:"+a+"\n";
						text.setText(a1);
						String a2="客户姓名:"+b+"\n";
						text.append(a2);
						String a3="客户姓名:"+c+"\n";
						text.append(a3);
						String a4="客户电话:"+d+"\n";;
						text.append(a4);
				    
					}
				}
				catch(SQLException e1) 
				{
					JOptionPane.showMessageDialog(this,"查询失败");
				}
			}
			
		}
		else if(e.getSource()==button2)
		{
			new MainWin();
			dispose();//释放当前界面
		}
		
		
	}

}

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值