<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                創建數據庫,連接數據庫,繪制界面,讀取數據庫信息 數據庫表: ~~~ CREATE TABLE `xuesheng` ( `xuehao` varchar(20) NOT NULL, `xingming` varchar(10) DEFAULT NULL, `xingbie` varchar(2) DEFAULT NULL, `nianling` int(8) DEFAULT NULL, `jiguan` varchar(10) DEFAULT NULL, `yxmc` varchar(10) DEFAULT NULL, PRIMARY KEY (`xuehao`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ~~~ ![](https://box.kancloud.cn/842efaa53ca3115520e97daa026df5c5_524x150.png) Test.java ~~~ package studysystem; import java.awt.*; import java.awt.event.*; import java.sql.*; import java.util.*; import javax.swing.*; public class Test extends JFrame { JPanel mb1,mb2; JLabel bq1;//標簽 JTextField wbk1;//文本框 JButton an1,an2,an3,an4;//按鈕 JTable bg1; //表格 JScrollPane gd1;//滾動條 Vector ziduan,jilu;//字段和記錄兩個集合類 PreparedStatement ps=null; Connection ct=null; //聲明Connection對象 ResultSet rs=null; public static void main(String[] args) { Test xs=new Test(); } public Test() { mb1=new JPanel(); bq1=new JLabel("請輸入姓名"); wbk1=new JTextField(10); an1=new JButton("查詢"); mb1.add(bq1); mb1.add(wbk1); mb1.add(an1); mb2=new JPanel(); an2=new JButton("添加"); an3=new JButton("修改"); an4=new JButton("刪除"); mb2.add(an2); mb2.add(an3); mb2.add(an4); ziduan =new Vector(); ziduan.add("學號"); ziduan.add("姓名"); ziduan.add("性別"); ziduan.add("年齡"); ziduan.add("籍貫"); ziduan.add("所在院系"); jilu =new Vector(); try { //加載驅動程序 Class.forName("com.mysql.jdbc.Driver"); ct=DriverManager.getConnection("jdbc:mysql://122.14.200.136:3306/javadb","root","6a133f0024"); ps=ct.prepareStatement("select * from xuesheng"); rs=ps.executeQuery(); while(rs.next()){ Vector hang=new Vector(); hang.add(rs.getString(1)); hang.add(rs.getString(2)); hang.add(rs.getString(3)); hang.add(rs.getInt(4)); hang.add(rs.getString(5)); hang.add(rs.getString(6)); jilu.add(hang); } } catch (Exception e) { }finally{//關閉資源 try { if(rs!=null) { rs.close(); } if(ps!=null) { ps.close(); } if(ct!=null) { ct.close(); } } catch (Exception e2){} } //JTable 后面的括號先記錄后字段 bg1=new JTable(jilu,ziduan); gd1=new JScrollPane(bg1); this.add(gd1); this.add(mb1,"North"); this.add(mb2,"South"); this.setTitle("學生管理系統"); this.setSize(500,400); this.setLocation(201,181); this.setResizable(false); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true); } } ~~~ ![](https://box.kancloud.cn/374b1a1a8dfbf3bebdc44d100e61ef35_508x412.png)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看