欢迎来到天天文库
浏览记录
ID:39726150
大小:230.01 KB
页数:69页
时间:2019-07-10
《网上书店完整代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、《网上书店信息管理系统的设计与实现》第69页共34页附录全部源代码packagecom.shoeShop.db;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.SQLException;publicclassConnect{privatestaticConnectioncon=null;privatestaticStringurl="jdbc:oracle:thin:@localhost:1521:ORCL";privatestaticStringdriver
2、="oracle.jdbc.driver.OracleDriver";privatestaticStringuser="scott";privatestaticStringpwd="tiger";publicstaticConnectiongetConnection(){try{Class.forName(driver);con=DriverManager.getConnection(url,user,pwd);System.out.println("数据库连接成功!");}catch(ClassNotFoundExceptione){System.
3、out.println("驱动加载失败!");;}catch(SQLExceptione){System.out.println("数据库连接失败!");}returncon;}publicstaticvoidmain(String[]args){Connect.getConnection();}}《网上书店信息管理系统的设计与实现》第69页共34页packagecom.shoeShop.action;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;import
4、javax.swing.JPanel;importcom.shoeShop.view.RegisterFrame;publicclassdocMenuActionimplementsActionListener{RegisterFrameregister=null;JPanelcusPanel=null;JPaneldocPanel=null;publicdocMenuAction(RegisterFrameregister){this.register=register;this.cusPanel=register.cusPanel;this.do
5、cPanel=register.docPanel;}publicvoidactionPerformed(ActionEvente){//TODOAuto-generatedmethodstubregister.flag=1;//System.out.println(register.flag);register.remove(cusPanel);register.add(docPanel);docPanel.updateUI();}}packagecom.shoeShop.dao;《网上书店信息管理系统的设计与实现》第69页共34页importjav
6、a.sql.Connection;importjava.sql.ResultSet;importjava.sql.SQLException;importjava.sql.Statement;importcom.shoeShop.db.Connect;importcom.shoeShop.entity.Buyer;importcom.shoeShop.entity.Seller;publicclassBuyerDao{privatestaticConnectionconn;privatestaticStatementstatement;privates
7、taticResultSetresultSet;//插入数据,用于注册publicintinsertBuyer(Buyerbuyer){intflag=0;conn=Connect.getConnection();try{statement=conn.createStatement();Stringsql="insertintobuyervalues('"+buyer.getId()+"','"+buyer.getName()+"','"+buyer.getPwd()+"','"+buyer.getAddress()+"')";//System.ou
8、t.println("buyer"+sql);flag=statement.executeUpdate(sq
此文档下载收益归作者所有