📄 userbean.java
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package stuMS;import java.sql.*;import javax.swing.*;/** * * @author Administrator */public class UserBean { String userId; String userName; String password; String sql; ResultSet results = null; public String [][]getAllStuInfo() { int row =0,i=0,j=0; String[][]user = null; Database DB = new Database(); sql = "select * from UserInfo"; try { DB.OpenConn(); results = DB.executeQuery(sql); if (results.last()) { row = results.getRow(); } if (row == 0) { user =null; JOptionPane.showMessageDialog(null, "没有记录!"); return null; } else { user = new String[row][3]; results.first(); results.previous(); while (results.next()) { for (j = 0; j < 3; j++) { user[i][j] = results.getString(j+1); } i++; j = 0; } } } catch (Exception e) { System.out.println(e); } finally { DB.closeStmt(); DB.closeConn(); } return user;}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -