面向对象程序课程设计学生个人信息管理系统课程设计报告书

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

08-70820010723.............................................................................................................-2-..................................................................................................-2-......................................................................................-3-...........................................................................................-4-...................................................................................-5-............................................................................................-5-..........................................................-5-.....................................................................-6-.....................................................................-6-.............................................................................................-6-.................................................................................................-6-.................................................................................................-7-08-70820010723C/S08-708200107234-108-708200107234.1varchar10varchar10varchar10varchar20varchar5varchar10varchar1N4-2E-R08-708200107231home234Framehome//JMenuBarmenuBar=newJMenuBar();//JMenufunction=newJMenu();//JMenuItemluru=newJMenuItem();//5publicstaticvoidmian()//1insert2ActionLIstener34JTextFieldvsno;//insertJTextFieldvsname;//insertJTextFieldvsbirth;//insertJTextFieldvsid;//insertJTextFieldvssex;//insertJTextFieldvsclass;//insertJTextFieldvsintr;//insert5publicvoidactionPerformed(ActionEvente)//08-708200107231query2ActionLIstener34JButtonjbysno=newJButton();//vsno.setText(rs.getString(sno))//5actionPerformed(ActionEvente)//1alterlist2ActionListener34JButtonalsno=newJButton();//vsno.setText(rs.getString(sno))//5publicvoidactionPerformed(ActionEvente);//windowsxp08-708200107231homeinsertinsertnewinsert().main(null);2insertactionPerformedMySQLjar3insertinsertinfo4insertinsertinfoClass.forName(com.mysql.jdbc.Driver);try-catch5queryquerybynumSQLExceptionQUERYSQL4-34-54-708-708200107236queryquerybyname7insertactionPerformedif!8alterlistalterinfoSQLINSERTINTOSQLUPDATEWHEREJava62009.Java200408-70820010723Java2002.2003.Java,2008.Java2009.BruceEckeJava2007.6Java2006.7insertinfoclassinsertinfoimplementsActionListener{08-70820010723JTextFieldvsno;JTextFieldvsname;JTextFieldvsbirth;JTextFieldvsid;JTextFieldvssex;JTextFieldvsclass;JTextFieldvsintr;publicinsertinfo(JTextFieldvsno,JTextFieldvsname,JTextFieldvsbirth,JTextFieldvsid,JTextFieldvssex,JTextFieldvsclass,JTextFieldvsintr){this.vsno=vsno;this.vsname=vsname;this.vsbirth=vsbirth;this.vsid=vsid;this.vssex=vssex;this.vsclass=vsclass;this.vsintr=vsintr;}publicvoidactionPerformed(ActionEvente){StringregexName=[\u4e00-\u9fa5]{2,4};StringregexDate=^(?:([0-9]{4}-(?:(?:0?[1,3-9]|1[0-2])-(?:29|30)|+((?:0?[13578]|1[02])-31)))|+([0-9]{4}-(?:0?[1-9]|1[0-2])-(?:0?[1-9]|1\\d|2[0-8]))|+(((?:(\\d\\d(?:0[48]|[2468][048]|[13579][26]))|+(?:0[48]00|[2468][048]00|[13579][26]00))-0?2-29)))$;if(vsno.getText().equals())JOptionPane.showMessageDialog(null,);elseif(vsname.getText().equals())JOptionPane.showMessageDialog(null,);elseif(!vsname.getText().matches(regexName))JOptionPane.showMessageDialog(null,);elseif(vsbirth.getText().equals())JOptionPane.showMessageDialog(null,);elseif(!vsbirth.getText().matches(regexDate))JOptionPane.showMessageDialog(null,);elsetry{Stringurl=jdbc:mysql://localhost:3306/kcsj;Stringuser=root;//Stringpassword=123;//Class.forName(com.mysql.jdbc.Driver);//Connectioncon=DriverManager.getConnection(url,user,password);//Statementst=con.createStatement();//08-70820010723SQLst.executeUpdate(INSERTINTOstuinfoVALUES('+vsno.getText()+','+vsname.getText()+','+vsbirth.getText()+','+vsid.getText()+','+vssex.getText()+','+vsclass.getText()+','+vsintr.getText()+'));//st.close();con.close();JOptionPane.showMessageDialog(null,);}catch(Exceptione1){JOptionPane.showMessageDialog(null,);}}}resultbysnopublicclassrusultbysno{publicstaticvoidmain(JTextFieldjsno){try{Stringurl=jdbc:mysql://localhost:3306/kcsj;Stringuser=root;//Stringpassword=123;////Class.forName(com.mysql.jdbc.Driver);//Connectioncon=DriverManager.getConnection(url,user,password);//SQLStatementst=con.createStatement();ResultSetrs=st.executeQuery(SELECT*FROMstuinfoWHEREsno='+jsno.getText()+');while(rs.next()){vsno.setText(rs.getString(sno));vsname.setText(rs.getString(sname));vsbirth.setText(rs.getString(sbirth));vsid.setText(rs.getString(sid));vssex.setText(rs.getString(ssex));vsclass.setText(rs.getString(sclass));vsintr.setText(rs.getString(sintr));}rs.close();//st.close();con.close();}catch(Exceptione1){08-70820010723System.out.println();}}}resultbynamepublicclassresultbysname{publicstaticvoidmain(JTextFieldjsname){try{Stringurl=jdbc:mysql://localhost:3306/kcsj;Stringuser=root;//Stringpassword=123;////Class.forName(com.mysql.jdbc.Driver);/Connectioncon=DriverManager.getConnection(url,user,password);///SQLStatementst=con.createStatement();Resu

1 / 16
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功