基于Java和Oracle的学生信息管理系统

发布时间 : 星期四 文章基于Java和Oracle的学生信息管理系统更新完毕开始阅读

String pad = password.getText();

String sql1=\+id+\; if(e.getSource()==Changepassword) {

try { }

catch (ClassNotFoundException ce) { } try {

Connection con =

JOptionPane.showMessageDialog(s,ce.getMessage()); Class.forName(\);

String sql2=\+id+\+pad+\;

DriverManager.getConnection(\,\\,\);

Statement stmt = con.createStatement();

ResultSet rs = stmt.executeQuery(\);

rs=stmt.executeQuery(\ID='\+id+\);

if(id.equals(\)) {

JOptionPane.showMessageDialog(s,\学号未填写!\); }

else if(rs.next())//如果账号存在 {

if(pad.equals(0)) { }

49

JOptionPane.showMessageDialog(s,\密码未填写!\);

else { \);

setVisible(false); } rs.close(); stmt.close();

stmt.executeUpdate(sql1); stmt.executeUpdate(sql2);

{

JOptionPane.showMessageDialog(s,\密码已重置!

} } else {

JOptionPane.showMessageDialog(s,\学号不存在,请重新输入正确的学号!\); }

}

public static void main(String[] args)

50

}

}

catch (SQLException se) { }

JOptionPane.showMessageDialog(s,se.getMessage());

else { }

ID.setText(\); password.setText(\); ID.requestFocus();

}

{ }

@SuppressWarnings(\)

Changepassword ch = new Changepassword();

3.5.教师修改登录密码模块 //函数库

import javax.swing.*; import java.awt.event.*; import java.sql.*;

public class tchlogpassword extends JFrame implements ActionListener {

private static final long serialVersionUID = 1L; /*修改登陆密码控件*/ static Changepassword s; JPanel jpl = new JPanel();

JLabel label1 = new JLabel(\账 号\,JLabel.LEFT); JLabel label2 = new JLabel(\原 密 码\,JLabel.LEFT); JLabel label3 = new JLabel(\新 密 码\,JLabel.LEFT); JTextField ID = new JTextField();

JTextField oldpassword = new JTextField(); JTextField password = new JTextField();

JButton Changepassword = new JButton(\重 置\); JButton reset = new JButton(\清 空\); public tchlogpassword() {

super(\修改登陆密码(教师)\); this.setSize(500,400); this.setVisible(true); //将当前窗口防止在屏幕中央 setLocationRelativeTo(null); this.setResizable(false);

51

}

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.add(jpl); jpl.setLayout(null);

Changepassword.addActionListener(this); reset.addActionListener(this); label1.setBounds(140,120,50,20); jpl.add(label1);

ID.setBounds(190,120,150,20); jpl.add(ID);

label2.setBounds(140,160,50,20); jpl.add(label2);

oldpassword.setBounds(190,160,150,20); jpl.add(oldpassword);

label3.setBounds(140,200,50,20); jpl.add(label3);

password.setBounds(190,200,150,20); jpl.add(password);

Changepassword.setBounds(190,240,70,20); jpl.add(Changepassword); reset.setBounds(270,240,70,20); jpl.add(reset);

public void actionPerformed(ActionEvent e) {

String id = ID.getText();

String oldpad = oldpassword.getText(); String pad = password.getText(); if(e.getSource()==Changepassword) {

try {

52

联系合同范文客服:xxxxx#qq.com(#替换为@)