网上书店源码
基于Java的网上书店系统的设计与实现(含源文件)
盐城师范学院毕业论文(设计)2013-2014学年度基于Java的网上书店系统的设计与实现-书籍管理部分学生姓名学院专业软件工程班级学号指导教师2014年5 月23日基于Java的网上书店系统的设计与实现—书籍管理部分摘要网上书店是随着网络技术的发展而出现的一种创新型图书销售方式,它通过人与电子通信方式的结合,以通讯技术为基础,依靠计算机网络为媒介,实现图书的网上交易。
本系统主要运用到了SSH框架以及三层架构,结合了Java和Jsp技术,以Eclipse+jdk作为开发平台,结合MySQL数据库支撑建立数据库连接关系。
本报告主要介绍了网上书店系统的开发背景和研究内容,采用面向对象开发方法,较详细的阐述了书籍展示、书籍搜索、书籍维护等书籍管理功能。
【关键词】网上书店;Java;SSH框架;书籍管理;EclipseThe Design and Implementation of Online Bookstore System Based on Java —Book ManagementAbstractOnline bookstore is an innovative way to sell books with the development of network tec hnology.It is through a combination of human and electronic communication,which is base d on communication technologies and rely on computer networks as the media to realize the o nline trading of books。
The system combines Java with Jsp technology to Eclipse + jd k as a development platform, which combines with MySQL database to support to est ablish a database connection relations,this system mainly applies the SSH framework and three—tier architecture. This report introduces mainly the background and researc h content of the online bookstore system, using object—oriented development method s,describing the book display, book search, book maintenance and any other book m anagement functions.【Key words】:online bookstore; Java;The SSH Framework; book management;Eclipse目录引言 (1)1选题背景及研究意义 (1)1。
JSP网上书店开发完整实例(含完整源代码)
完整的简单jsp网上书店详细实例计算机web编程jsp毕业论文、考试复习资料必备其中包括的详细需求、业务分析、数据库、源代码我们使用JSP和Java Bean来构建一个网上书店。
介绍的例子可以分成两大部分,第一部分是普通程序,用于客户在网上选购图书,第二部分是管理程序,用于在服务器端处理客户的定单。
客户端程序由以下几个部分构成:default.jsp:会员登录界面(首页);checklogon.jsp:检测登录代码和密码是否一致,根据由JavaBean返回的结果显示不同的信息。
BuyerBean:会员的合法性检验所用的Bean;booklist.jsp:给登录会员显示当前书店中可供选择的图书;addcart.jsp:将所选的图书加入购物车;shoppingcart.jsp:查看购物车的内容;本例的数据库采用Access(.MDB数据库),对数据库的访问采用便于理解的JDBC-ODBC方式,在使用本例前先在本地数据库建立一个ODBC数据源:bookstore。
设置步骤如下:(1)在开始->设置->控制面版(Win98、NT4.0)中选取“数据源(ODBC)”;在Win 2000 Professional和Server中分别位于“开始->设置->控制面版->管理工具”和“开始->程序->管理工具”下。
(2)启动“数据源(ODBC)”配置程序,界面如图15-1所示。
图15-1 ODBC数据源管理界面(3)在图15-1中“系统DSN”选项下单击“添加”按钮,来添加一个系统的数据源(DSN),则出现如图15-2所示数据源驱动程序选择界面:图15-2 数据源驱动程序选择界面(4)在图15-2中选择“Microsoft Access Driver (*.mdb)”单击“完成”加载Access数据库的驱动,则出现如图15-3所示数据库ODBC安装界面:图15-3 数据库ODBC安装界面(5)在图15-3中单击“选择(S)…”按钮,启动一个类似资源管理器的界面来选择数据库,如图15-4所示,在图15-4所示的界面中选择bookstore.mdb。
书店销售管理系统源代码
书店销售管理系统Delphi 源代码program Book_Manager;usesForms,uni_main in 'uni_main.pas' {frm_main},uni_out in 'uni_out.pas' {frm_out},uni_DM in 'uni_DM.pas' {DM: TDataModule},uni_in in 'uni_in.pas' {frm_in},uni_book in 'uni_book.pas' {frm_book};{$R *.res}beginApplication.Initialize;Application.CreateForm(Tfrm_main, frm_main);Application.Run;end.unit uni_main;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Menus, ComCtrls, ToolWin, ImgList;typeTfrm_main = class(TForm)MainMenu1: TMainMenu;N1: TMenuItem;N2: TMenuItem;N3: TMenuItem;N4: TMenuItem;N5: TMenuItem;N6: TMenuItem;N7: TMenuItem;N8: TMenuItem;N9: TMenuItem;N10: TMenuItem;ToolBar1: TToolBar;ToolButton1: TToolButton;ToolButton2: TToolButton;ToolButton3: TToolButton;ToolButton4: TToolButton;ToolButton5: TToolButton;ImageList1: TImageList;ToolButton6: TToolButton;ToolButton7: TToolButton;procedure N2Click(Sender: TObject);procedure FormCreate(Sender: TObject);procedure N3Click(Sender: TObject);procedure N4Click(Sender: TObject);procedure ToolButton1Click(Sender: TObject);procedure ToolButton2Click(Sender: TObject);procedure ToolButton3Click(Sender: TObject);procedure N6Click(Sender: TObject);procedure ToolButton4Click(Sender: TObject);procedure N7Click(Sender: TObject);procedure ToolButton5Click(Sender: TObject);procedure N9Click(Sender: TObject);procedure N10Click(Sender: TObject);procedure ToolButton6Click(Sender: TObject);procedure ToolButton7Click(Sender: TObject); private{ Private declarations }public{ Public declarations }end;varfrm_main: Tfrm_main;implementationuses uni_out,uni_dm, uni_in, uni_book;{$R *.dfm}procedure Tfrm_main.N2Click(Sender: TObject); vari:integer;beginfor i:=0 to frm_main.MDIChildCount-1 dobeginif frm_main.MDIChildren[i]=frm_out thenbeginfrm_out.PageControl1.ActivePageIndex:=0;exit;end;end;application.CreateForm(Tfrm_out,frm_out);frm_out.PageControl1.ActivePageIndex:=0; end;procedure Tfrm_main.FormCreate(Sender: TObject); beginApplication.CreateForm(Tdm,dm);end;procedure Tfrm_main.N3Click(Sender: TObject); var i:integer;beginfor i:=0 to frm_main.MDIChildCount-1 dobeginif frm_main.MDIChildren[i]=frm_out thenbeginfrm_out.PageControl1.ActivePageIndex:=1;exit;end;end;application.CreateForm(Tfrm_out,frm_out);frm_out.PageControl1.ActivePageIndex:=1; end;procedure Tfrm_main.N4Click(Sender: TObject); var i:integer;beginfor i:=0 to frm_main.MDIChildCount-1 dobeginif frm_main.MDIChildren[i]=frm_out thenbeginfrm_out.PageControl1.ActivePageIndex:=2;exit;end;end;application.CreateForm(Tfrm_out,frm_out);frm_out.PageControl1.ActivePageIndex:=2; end;procedure Tfrm_main.ToolButton1Click(Sender: TObject); beginN2Click(Sender);end;procedure Tfrm_main.ToolButton2Click(Sender: TObject); beginN3Click(Sender);end;procedure Tfrm_main.ToolButton3Click(Sender: TObject); beginN4Click(Sender);end;procedure Tfrm_main.N6Click(Sender: TObject);var i:integer;beginfor i:=0 to frm_main.MDIChildCount-1 dobeginif frm_main.MDIChildren[i]=frm_in thenbeginfrm_in.PageControl1.ActivePageIndex:=0;exit;end;end;application.CreateForm(Tfrm_in,frm_in);frm_in.PageControl1.ActivePageIndex:=0;end;procedure Tfrm_main.ToolButton4Click(Sender: TObject); beginN6Click(Sender);end;procedure Tfrm_main.N7Click(Sender: TObject);var i:integer;beginfor i:=0 to frm_main.MDIChildCount-1 dobeginif frm_main.MDIChildren[i]=frm_in thenbeginfrm_in.PageControl1.ActivePageIndex:=1;exit;end;end;application.CreateForm(Tfrm_in,frm_in);frm_in.PageControl1.ActivePageIndex:=1;end;procedure Tfrm_main.ToolButton5Click(Sender: TObject); beginN7Click(Sender);end;procedure Tfrm_main.N9Click(Sender: TObject);var i:integer;beginfor i:=0 to frm_main.MDIChildCount-1 dobeginif frm_main.MDIChildren[i]=frm_book thenbeginfrm_book.PageControl1.ActivePageIndex:=0;exit;end;end;application.CreateForm(Tfrm_book,frm_book);frm_book.PageControl1.ActivePageIndex:=0;end;procedure Tfrm_main.N10Click(Sender: TObject);var i:integer;beginfor i:=0 to frm_main.MDIChildCount-1 dobeginif frm_main.MDIChildren[i]=frm_book thenbeginfrm_book.PageControl1.ActivePageIndex:=1;exit;end;end;application.CreateForm(Tfrm_book,frm_book);frm_book.PageControl1.ActivePageIndex:=1;end;procedure Tfrm_main.ToolButton6Click(Sender: TObject); beginN9Click(Sender);end;procedure Tfrm_main.ToolButton7Click(Sender: TObject);beginN10Click(Sender);end;end.unit uni_out;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ComCtrls, DB, ADODB, Grids, DBGrids, StdCtrls, ExtCtrls;typeTfrm_out = class(TForm)PageControl1: TPageControl;TabSheet1: TTabSheet;cb_id: TComboBox;Label1: TLabel;Label2: TLabel;edt_name: TEdit;Label3: TLabel;edt_price: TEdit;Label4: TLabel;edt_num: TEdit;Label5: TLabel;edt_publisher: TEdit;Label6: TLabel;edt_writer: TEdit;Label7: TLabel;edt_date: TEdit;DBGrid1: TDBGrid;Label8: TLabel;ds_out: TDataSource;btn_OK: TButton;qy_book:TADOQuery;qy_out: TADOQuery;Panel1: TPanel;TabSheet2: TTabSheet;edt_year: TEdit;Label9: TLabel;qy_outBookID: TWideStringField;qy_outBookName: TWideStringField; qy_outDate: TWideStringField;qy_outNum: TIntegerField;qy_outPrice: TBCDField;qy_outtotal: TCurrencyField;Label10: TLabel;edt_month: TEdit;Label11: TLabel;edt_day: TEdit;Label12: TLabel;btn_date: TButton;qy_day: TADOQuery;ds_day: TDataSource;DBGrid2: TDBGrid;lbl_caption: TLabel;btn_day: TButton;qy_create: TADOQuery;TabSheet3: TTabSheet;Label13: TLabel;edt_year1: TEdit;cb_month: TComboBox;Label14: TLabel;qy_month: TADOQuery;ds_month: TDataSource;grid_month: TDBGrid;btn_month: TButton;qy_view: TADOQuery;ds_view: TDataSource;grid_view: TDBGrid;lbl_month: TLabel;qy_dayBookID: TWideStringField;qy_dayBookName: TWideStringField; qy_dayDate: TWideStringField;qy_dayNum: TIntegerField;qy_dayPrice: TBCDField;qy_viewBookID: TWideStringField;qy_viewBookName: TWideStringField; qy_viewNum: TIntegerField;qy_viewAvePrice: TBCDField;qy_viewTotal: TBCDField;qy_monthBookID: TWideStringField;qy_monthBookName: TWideStringField;qy_monthDate: TWideStringField;qy_monthNum: TIntegerField;qy_monthPrice: TBCDField;procedure FormClose(Sender: TObject; var Action: TCloseAction);procedure FormCreate(Sender: TObject);procedure cb_idChange(Sender: TObject);procedure btn_OKClick(Sender: TObject);procedure qy_outCalcFields(DataSet: TDataSet);procedure btn_dateClick(Sender: TObject);procedure btn_dayClick(Sender: TObject);procedure cb_monthChange(Sender: TObject);procedure btn_monthClick(Sender: TObject);private{ Private declarations }public{ Public declarations }end;varfrm_out: Tfrm_out;today,dayStr,month:String;bookNum:Integer;implementationuses uni_DM;{$R *.dfm}procedure Tfrm_out.FormClose(Sender: TObject; var Action: TCloseAction); beginaction:=cafree;end;procedure Tfrm_out.FormCreate(Sender: TObject);begintoday:=formatdatetime('yyyy-m-d',now);with qy_book dobeginclose;sql.Clear;sql.Add('select id from book');tryopen;first;while not eof dobegincb_id.Items.Add(fieldbyname('id').AsString);next;end;finallyclose;end;end;with qy_out dobeginclose;sql.Clear;sql.Add('select * from bookout where date='+quotedstr(today));tryopen;exceptshowmessage('·ÃÎÊÊý¾Ý¿â³ö´í!');exit;end;end;end;procedure Tfrm_out.cb_idChange(Sender: TObject);beginif cb_id.Text='' then exit;with qy_book dobeginclose;sql.Clear;sql.Add('select * from book where id='+quotedstr(cb_id.Text));tryExecsql;open;first;edt_name.Text:=fieldbyname('name').AsString;edt_writer.Text:=fieldbyname('writer').AsString;edt_price.Text:=floattostr(fieldbyname('price').AsFloat*fieldbyname('discount').AsFloat);edt_publisher.Text:=fieldbyname('publisher').AsString;edt_date.Text:=fieldbyname('publishdate').AsString;bookNum:=fieldbyname('num').AsInteger;exceptshowmessage('·ÃÎÊÊý¾Ý¿â³ö´í£¡');close;end;end;btn_ok.Enabled:=true;end;procedure Tfrm_out.btn_OKClick(Sender: TObject);varnum:integer;numOut:integer;begintrynumout:=strtoint(edt_num.Text);exceptshowmessage('ÇëÕýÈ·ÊäÈëÊýÁ¿£¡');exit;end;if numout>bookNum thenbeginshowmessage('¸ÃÊé¿â´æֻʣÏÂ'+inttostr(bookNum)+',¿â´æ²»×㣡');exit;end;with qy_out dobeginclose;sql.Clear;sql.Add('select * from bookout where bookID='+quotedstr(cb_id.Text));sql.Add(' and date='+quotedstr(today));tryopen;if recordcount<>0 then //Èç¹ûµ±ÌìÒѾ-ÓдËÊéµÄÏúÊۼǼ,Ôò¸ü¸ÄÊýÁ¿ beginnum:=numout+fieldbyname('num').AsInteger;close;sql.Clear;sql.Add('update bookout set num='+inttostr(num)+' where bookID=');sql.Add(quotedstr(cb_id.Text)+' and date='+quotedstr(today));execsql;endelse begin //Èç¹ûûÓÐ,Ôö¼ÓÒ»ÌõеļǼclose;sql.Clear;sql.Add('select * from bookout');open;append;fieldbyname('bookid').AsString:=cb_id.Text;fieldbyname('bookname').AsString:=edt_name.Text;fieldbyname('date').AsString:=today;fieldbyname('num').AsInteger:=strtoint(edt_num.Text);fieldbyname('price').AsCurrency:=strtofloat(edt_price.Text);post;end;sql.Clear; //ÖØÐÂÏÔʾµ±ÌìµÄÏúÊۼǼsql.Add('select * from bookout where date='+quotedstr(today));open;exceptshowmessage('·ÃÎÊÊý¾Ý¿â³ö´í!');exit;end;end;showmessage('½»Ò׳ɹ¦£¡');btn_ok.Enabled:=false;edt_name.Text:='';edt_writer.Text:='';edt_publisher.Text:='';edt_date.Text:='';edt_price.Text:='';with qy_book dobeginclose;sql.Clear;sql.Add('select * from book where id='+quotedstr(cb_id.Text));tryopen;edit;fieldbyname('num').AsInteger:=bookNum-strtoint(edt_num.text);post;finallyclose;end;end;end;procedure Tfrm_out.qy_outCalcFields(DataSet: TDataSet);beginqy_outtotal.Value:=qy_outprice.Value*qy_outnum.Value;end;procedure Tfrm_out.btn_dateClick(Sender: TObject);varday:TDateTime;begindayStr:=edt_year.Text+'-'+edt_month.Text+'-'+edt_day.Text;tryday:=strtodatetime(dayStr);if day>=now thenbeginshowmessage('ÈÕÆÚ³¬Ç°£¡');exit;end;exceptshowmessage('ÇëÊäÈëÕýÈ·µÄÈÕÆÚ£¡');exit;end;with qy_day dobeginclose;sql.Clear;sql.Add('select * from bookout where date='+quotedstr(dayStr));tryopen;exceptshowmessage('·ÃÎÊÊý¾Ý¿â³ö´í£¡');exit;end;end;lbl_caption.Caption:=edt_year.Text+'Äê'+edt_month.Text+'ÔÂ'+edt_day.Text+'ÈÕ'+'ÏúÊÛÇé¿öÒ»ÀÀ±í';btn_day.Enabled:=true;end;procedure Tfrm_out.btn_dayClick(Sender: TObject);vartablename:String;begintablename:=formatdatetime('yyyymmdd',strtodatetime(dayStr));with qy_create dobeginclose;sql.Clear;sql.Add('select bookid,bookname,num,price into '+tablename+' from bookout');sql.Add(' where date='+quotedstr(dayStr));tryexecsql;exceptshowmessage('µ±ÌìµÄÏúÊÛÇé¿ö±¸·Ý±íÒѾ-´æÔÚ£¡');exit;end;end;showmessage('³É¹¦´´½¨¸ÃÈÕÏúÊÛ±í£¡');btn_day.Enabled:=false;end;procedure Tfrm_out.cb_monthChange(Sender: TObject);vary,m:string;beginy:=formatdatetime('yyyy',now);m:=formatdatetime('m',now);tryif (strtoint(edt_year1.Text)>strtoint(y))or((strtoint(edt_year1.Text)=strtoint(y)) and (strtoint(cb_month.Text)>=strtoint(m))) thenbeginshowmessage('ÈÕÆÚ³¬Ç°£¡');exit;end;exceptshowmessage('ÇëÊäÈëÕýÈ·µÄÔ·ݣ¡');exit;end;month:=edt_year1.Text+'-'+cb_month.Text;with qy_month dobeginclose;sql.Clear;sql.Text:='select * from bookout where date like ';sql.Text:=sql.Text+quotedstr(month+'-%')+' order by bookID';;tryopen;grid_month.Visible:=true;grid_view.Visible:=false;exceptshowmessage('·ÃÎÊÊý¾Ý¿â³ö´í£¡');close;exit;end;end;btn_month.Enabled:=true;lbl_month.Caption:=edt_year1.Text+'Äê'+cb_month.Text+'ÔÂÏúÊÛÇé¿ö±í';end;procedure Tfrm_out.btn_monthClick(Sender: TObject);varid,bookname:string;num:integer;total,AvePrice:currency;TableName:String;beginTableName:=edt_year1.Text+cb_month.Text;with qy_create dobeginclose;sql.Clear;sql.Add('select * into '+tablename+' from monthout');tryexecsql;exceptshowmessage('¸ÃÔµÄͳ¼Æ±íÒѾ-´æÔÚ£¡');qy_view.close;qy_view.SQL.Clear;qy_view.SQL.Add('select * from '+tablename);qy_view.open;grid_month.Visible:=false;grid_view.Visible:=true;lbl_month.Caption:=edt_year1.Text+'Äê'+cb_month.Text+'ÔÂÏúÊÛÇé¿öͳ¼Æ±í';exit;end;sql.Clear;sql.Add('select * from '+tablename);tryopen;append;qy_month.First;id:=qy_month.fieldbyname('bookid').AsString;bookname:=qy_month.fieldbyname('bookname').AsString;num:=0;total:=0;while not qy_month.Eof dobeginif id=qy_month.FieldByName('bookid').AsString thenbeginnum:=num+qy_month.fieldbyname('num').AsInteger;total:=total+qy_month.fieldbyname('price').AsCurrency*qy_month.fieldbyname('num').AsInteger ;endelse beginAvePrice:=total/num;fieldbyname('bookid').AsString:=id;fieldbyname('bookname').AsString:=bookname;fieldbyname('AvePrice').AsCurrency:=Aveprice;fieldbyname('num').AsInteger:=num;fieldbyname('total').AsCurrency:=total;post;append;id:=qy_month.fieldbyname('bookid').AsString;bookname:=qy_month.fieldbyname('bookname').AsString;num:=qy_month.fieldbyname('num').AsInteger;total:=qy_month.fieldbyname('num').AsInteger*qy_month.fieldbyname('price').AsCurrency;end;qy_month.Next;end;AvePrice:=total/num;fieldvalues['bookid']:=id;fieldvalues['bookname']:=bookname;fieldvalues['AvePrice']:=Aveprice;fieldvalues['num']:=num;fieldvalues['total']:=total;post;updatebatch;exceptshowmessage('´´½¨Í³¼Æ±í³ö´í£¡');exit;end;end;showmessage('³É¹¦´´½¨¸ÃÔµÄÏúÊÛͳ¼Æ±í£¡');qy_create.Close;qy_view.Close;qy_view.SQL.Clear;qy_view.SQL.Add('select * from '+tablename);qy_view.Open;grid_month.Visible:=false;grid_view.Visible:=true;lbl_month.Caption:=edt_year1.Text+'Äê'+cb_month.Text+'ÔÂÏúÊÛÇé¿öͳ¼Æ±í'; btn_month.Enabled:=false;end;end.unit uni_DM;interfaceusesSysUtils, Classes, DB, ADODB;typeTDM = class(TDataModule)ADOConnection1: TADOConnection;private{ Private declarations }public{ Public declarations }end;varDM: TDM;implementation{$R *.dfm}end.unit uni_in;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, DB, ADODB, ComCtrls, StdCtrls, Grids, DBGrids;typeTfrm_in = class(TForm)Panel1: TPanel;PageControl1: TPageControl;TabSheet1: TTabSheet;TabSheet2: TTabSheet;qy_in: TADOQuery;ds_in: TDataSource;Label1: TLabel;cb_bookid: TComboBox;qy_book: TADOQuery;Label2: TLabel;edt_priceIn: TEdit;edt_num: TEdit;Label3: TLabel;Label4: TLabel;edt_bookname: TEdit;Label5: TLabel;edt_writer: TEdit;Label6: TLabel;edt_publisher: TEdit;Label7: TLabel;edt_price: TEdit;btn_import: TButton;Label9: TLabel;edt_pubDate: TEdit;DBGrid1: TDBGrid;qy_inBookID: TWideStringField;qy_inDate: TWideStringField;qy_inNum: TIntegerField;qy_inPrice: TBCDField;Label8: TLabel;Label10: TLabel;edt_year: TEdit;Label11: TLabel;edt_month: TEdit;Label12: TLabel;edt_OK: TButton;data_month: TADODataSet;ds_month: TDataSource;DBGrid2: TDBGrid;Label13: TLabel;cb_bookid1: TComboBox;data_monthBookID: TWideStringField;data_monthDate: TWideStringField;data_monthNum: TIntegerField;data_monthPrice: TBCDField;data_monthbookname: TStringField;procedure FormCreate(Sender: TObject);procedure cb_bookidChange(Sender: TObject);procedure btn_importClick(Sender: TObject);procedure FormClose(Sender: TObject; var Action: TCloseAction);procedure edt_OKClick(Sender: TObject);procedure cb_bookid1Change(Sender: TObject);private{ Private declarations }public{ Public declarations }end;varfrm_in: Tfrm_in;today,month:String;bookNum:integer;bookExist:boolean;implementationuses uni_dm;{$R *.dfm}procedure Tfrm_in.FormCreate(Sender: TObject);begintoday:=formatdatetime('yyyy-m-d',now);with qy_book dobeginclose;sql.Clear;sql.Add('select id from book');tryopen;first;while not eof dobegincb_bookid.Items.Add(fieldbyname('id').AsString);next;end;cb_bookid1.Items:=cb_bookid.Items;finallyclose;sql.Text:='select * from book';end;end;with qy_in dobeginclose;sql.Clear;sql.Add('select * from bookin where date='+quotedstr(today));open;end;end;procedure Tfrm_in.cb_bookidChange(Sender: TObject);beginwith qy_book dobeginclose;sql.Clear;sql.Add('select * from book where id='+quotedstr(cb_bookid.Text));tryopen;if recordcount>0 then //¸ÃÊéÒѾ-´æÔÚ£¬Ôò¶Á³ö¸ÃÊé×ÊÁÏbeginbookExist:=true;edt_bookname.Text:=fieldbyname('name').AsString;edt_writer.Text:=fieldbyname('writer').AsString;edt_price.text:=fieldbyname('price').asstring;edt_pubdate.Text:=fieldbyname('publishdate').AsString;edt_publisher.Text:=fieldbyname('publisher').AsString;endelse bookExist:=false;finallyclose;sql.text:='select * from book';end;end;end;procedure Tfrm_in.btn_importClick(Sender: TObject);varnum:integer;pricein,price:currency;pubdate:String;beginif (cb_bookid.Text='') or(edt_bookname.Text='') or (edt_writer.Text='') or (edt_pricein.Text='') or (edt_price.Text='') or (edt_num.Text='')or (edt_pubdate.Text='') or (edt_publisher.Text='') thenbeginshowmessage('ÇëÌîдÍêÕû£¡');exit;end;trypricein:=strtofloat(edt_pricein.Text);price:=strtofloat(edt_price.Text);num:=strtoint(edt_num.Text);pubdate:=formatdatetime('yyyy-m-d',strtodatetime(edt_pubdate.Text));exceptshowmessage('¼Û¸ñ£¬ÊýÁ¿»òÈÕÆÚÊäÈë´íÎó£¡');exit;end;with qy_in dobeginclose;sql.Clear;sql.Add('select * from bookin');tryopen;append; //²åÈëÒ»ÌõмǼfieldbyname('bookid').AsString:=cb_bookid.Text;fieldbyname('price').AsCurrency:=pricein;fieldbyname('date').AsString:=today;fieldbyname('num').AsInteger:=num;post;close;sql.Clear;sql.Add('select * from bookin where date='+quotedstr(today));open; //ÖØÐÂÏÔʾexceptshowmessage('·ÃÎÊÊý¾Ý¿â³ö´í£¡');exit;end;end;with qy_book do //¸üÐÂÊé¿âbeginclose;sql.Clear;tryif bookExist then //ÈôÊéÒѾ-´æÔÚ£¬ÔòÐÞ¸ÄÊýÁ¿beginsql.Text:='update book set num='+inttostr(bookNum+num)+' where id='+quotedstr(cb_bookid.Text);execsql;endelse begin //ÈôÊé²»´æÔÚ£¬ÔòÔö¼ÓÒ»Ìõ¼Ç¼sql.Add('select * from book');open;append;fieldbyname('id').AsString:=cb_bookid.Text;fieldbyname('name').AsString:=edt_bookname.Text;fieldbyname('writer').AsString:=edt_writer.Text;fieldbyname('price').AsCurrency:=price;fieldbyname('publisher').AsString:=edt_publisher.Text;fieldbyname('publishDate').AsString:=pubdate;fieldbyname('num').AsInteger:=num;post;end;exceptshowmessage('Èë¿â³ö´í£¡');close;exit;end;sql.Text:='select * from book';showmessage('Èë¿â³É¹¦£¡');edt_bookname.Text:='';edt_publisher.Text:='';edt_pubdate.Text:='';edt_price.Text:='';edt_pricein.Text:='';edt_writer.Text:='';edt_num.Text:='';end;end;procedure Tfrm_in.FormClose(Sender: TObject; var Action: TCloseAction);beginaction:=cafree;end;procedure Tfrm_in.edt_OKClick(Sender: TObject);var y,m:String;beginy:=formatdatetime('yyyy',now);m:=formatdatetime('m',now);tryif (strtoint(edt_year.Text)>strtoint(y))or((strtoint(edt_year.Text)=strtoint(y))and (strtoint(edt_month.Text)>=strtoint(m))) thenbeginshowmessage('ÈÕÆÚ³¬Ç°£¡');exit;end;exceptshowmessage('ÇëÊäÈëÕýÈ·µÄÔ·ݣ¡');exit;end;month:=edt_year.Text+'-'+edt_month.Text;with data_month dobegincommandtext:='select * from bookin where date like '+quotedstr(month+'-%');active:=true;end;end;procedure Tfrm_in.cb_bookid1Change(Sender: TObject);beginif(edt_year.Text='')thenbeginshowmessage('ÇëÏÈÊäÈëÔ·Ý!');exit;end;if cb_bookid1.Text='' then exit;with data_month dobeginactive:=false;commandtext:='select * from bookin where date like ';commandtext:=commandtext+quotedstr(month+'-%')+' and bookid='+quotedstr(cb_bookid1.Text);active:=true;end;end;end.unit uni_book;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Grids, DBGrids, DB, ADODB, StdCtrls, ComCtrls, ExtCtrls, DBCtrls;typeTfrm_book = class(TForm)PageControl1: TPageControl;Panel1: TPanel;TabSheet1: TTabSheet;TabSheet2: TTabSheet;Label1: TLabel;cb_bookid: TComboBox;btn_OK: TButton;Label2: TLabel;edt_discount: TEdit;qy_book: TADOQuery;ds_book: TDataSource;DBGrid1: TDBGrid;qy_bookID: TWideStringField;qy_bookName: TWideStringField;qy_bookWriter: TWideStringField;qy_bookPublisher: TWideStringField;qy_bookPublishDate: TWideStringField;qy_bookPrice: TBCDField;qy_bookDiscount: TFloatField;qy_bookNum: TIntegerField;Label3: TLabel;cb_symbol: TComboBox;edt_num: TEdit;btn_find: TButton;qy_clear: TADOQuery;DataSource1: TDataSource;DBGrid2: TDBGrid;DBNavigator1: TDBNavigator;Button1: TButton;Button2: TButton;qy_clearID: TWideStringField;qy_clearName: TWideStringField;qy_clearWriter: TWideStringField;qy_clearPublisher: TWideStringField;qy_clearPublishDate: TWideStringField;qy_clearPrice: TBCDField;qy_clearDiscount: TFloatField;qy_clearNum: TIntegerField;Button3: TButton;Button4: TButton;procedure FormCreate(Sender: TObject);procedure cb_bookidChange(Sender: TObject);procedure btn_OKClick(Sender: TObject);procedure btn_findClick(Sender: TObject);procedure Button1Click(Sender: TObject);procedure Button2Click(Sender: TObject);procedure FormClose(Sender: TObject; var Action: TCloseAction);procedure Button3Click(Sender: TObject);procedure Button4Click(Sender: TObject);private{ Private declarations }public{ Public declarations }end;varfrm_book: Tfrm_book;implementationuses uni_DM;{$R *.dfm}procedure Tfrm_book.FormCreate(Sender: TObject);beginwith qy_book dobeginclose;sql.Text:='select * from book';tryopen;first;while not eof dobegincb_bookid.Items.Add(fieldbyname('id').AsString);next;。
JAVA综合实训网上书店程序
public ComputerBook(String name,float price,String info) { this.setName(name); this.setPrice(price); this.setInfo(info); } public String getName() { return ; } public float getPrice() { return this.price; } public String getInfo() { return ; } public void setName(String name) { = name; } public void setPrice(float price) { this.price = price; } public void setInfo(String info) { = info;
Book b1 = new ChildBook("三字经 ",10.0f,"正版超值 3VCD 幼儿儿童娱乐与教学之 《三字经百家姓》QQ 虫! "); Book b2 = new ChildBook("论语 ",12.0f,"正版超值 3VCD 幼儿儿童文化国学启蒙之 《论语》QQ 虫! "); Book b3 = new ChildBook("100 个国家的 100 处迷人地方",18.0f,"本丛书将带领你跨 越高山大海,穿梭时光隧道去世界各地旅行"); Book b4 = new ComputerBook("JAVA 实用教程",39.0f,"清华大学出版社 JAVA 语言 的核心技术"); Book b5 = new ComputerBook("C++",50.0f,"C++ 语言的核心技术"); Book b6 = new ComputerBook("android 开发入门指南",74.0f,"手机软件开发"); Book b7 = new CarBook("汽车维修技术",54.0f,"各类汽车维修技术"); Book b8 = new CarBook("如何开车",23.0f,"开车技术"); Book b9 = new CarBook("小车保养",58.0f,"小车保养技术"); BookShop bs = new BookShop("网上书店"); bs.append(b1); //添加图书信息 bs.append(b2); bs.append(b3); bs.append(b4); bs.append(b5); bs.append(b6); bs.append(b7); bs.append(b8); bs.append(b9); // print(bs.getAllBooks()); // print(bs.index("A")); Book b = bs.findByName("C++"); //System.out.println(b); bs.delete(b); print(bs.getAllBooks()); } public static void print(List all) { Iterator iter = all.iterator(); while(iter.hasNext()) { Book b = (Book)iter.next(); System.out.println(b); } } } //查询出全部的数据 //模糊查询,书名中有A的书 //将 C++这本书从书店删除掉
电子商务源码「电子商务源代码」
电子商务源码「电子商务源代码」搂主放心,我有一套网上书店,非常漂亮的,功能又特别强大的,现免费给网友下载这是程序说明软件名称网上书店asp网站管理系统源码正式版软件版本V2008 建议分类源码下载ASP源码电子商务演示网站;源代码一般可以刻盘交付,也有打包发邮件的不过前提是你和建站公司协议好可以给源代码的,因为有些网络公司不给源代码关于后期维护,只要你选择相对正规的网络公司,都是能保证正常维护的有什么修改或网站出现什么问题,打。
现在国内唯一做的正式商业化能用的免费开源电商系统只有ShopsN 注意是纯粹免费,允许商业运营的至于那种打着免费开源商城的系统,多如牛毛,也就没什么介绍的必要了ShopsN主打就是超越Ecshop适应时代潮流,采用thinkphp开发;Ueeshop跨境电商外贸建站系统是适合跨境电商模式的外贸建站系统,拥有兼容多种终端访问,主流多种语言版本,兼容第三方登陆,买家无需注册,直接登陆Ueeshop 因为是SaaS系统,所以一般情况下是不提供系统源码的,但是如果是需要定制的。
电子商务的论文写作大纲一毕业论文的目的毕业论文是培养学生综合运用本专业基础理论,基本知识和基本技能分析解决实际问题能力的一个重要环节它是本专业各个先修教学环节的继续深化和检验通过毕业论文使学生在实际的电子。
电子商务源码怎么获取中国最好的一些源码下载站点排名 1中国站长网下载为什么没有选择K6 理由很简单做为比K6年轻的源码下载站点靠自己的特色越做越大并且提供建站相关的一切东西更新速度也很快!估计。
远丰软件自主研发的全系列电子商务软件自成生态,主要有,基于人工智能的S2B2C新零售系统,社群电商系统,直播电商系统,小程序电商系统,App商城系统,分销系统,跨境电商系统,电商Erp系统,云收银系统,物流配送系统等自主知识产。
电商平台搭建方式方法1计划阶段向本公司的各个部门收取书面资料,如果有必要网站建设部门的人员可以派专人到其他部门聆听讲解,尤其要准确理解本公司的业务重点之所在2设计阶段当设计人员拿到网站文件明细表后开始。
新华书店进销存管理系统部分程序源代码(doc 31页)
新华书店进销存管理系统部分程序源代码(doc 31页)if user.password != alltrim(thisform.text2.value) thenbel3.caption="密码错误"returnendifendifnname = ndepartment = user.department nkfgl = user.kfglnxsgl = user.xsglncggl = user.cgglnkcgl = user.kcglnxtgl = user.xtglthisform.releaseclear events1、系统管理表单XTGLF.SCX代码4.1 表单Init过程程序代码thisform.text1.enabled = .f. thisform.text2.enabled = .f. thisform.text3.enabled = .f. bo1.enabled = .f. thisform.check1.enabled = .f. thisform.check2.enabled = .f. thisform.check3.enabled = .f. thisform.check4.enabled = .f. thisform.check5.enabled = .f. bel5.visible = .f. thisform.text3.visible = .f. mand10.enabled = .f. mand11.enabled = .f. thisform.dis_recordthisform.dis_reccommand4.2 表单自定义过程DIS_RECORD程序代码PUBLIC newcommandSTORE .f. TO newcommandif reccount("user") = 0thisform.text1.value = ""thisform.text2.value = ""bo1.value = ""thisform.check1.value = 0thisform.check2.value = 0thisform.check3.value = 0thisform.check4.value = 0thisform.check5.value = 0elsethisform.text1.value = thisform.text2.value = user.passwordbo1.value =user.departmentif user.kfgl thenthisform.check1.value = 1 elsethisform.check1.value = 0 endifif user.xsgl thenthisform.check2.value = 1 elsethisform.check2.value = 0 endifif user.cggl thenthisform.check3.value = 1 elsethisform.check3.value = 0 endifif user.kcgl thenthisform.check4.value = 1elsethisform.check4.value = 0endifif user.xtgl thenthisform.check5.value = 1elsethisform.check5.value = 0endifendifthisform.refresh4.3 表单自定义过程DIS_RECCOMMAND 程序代码private nstore 0 to nn = reccount("user")if n=1 .or. n=0 thenmand1.enabled = .f.mand2.enabled = .f. mand3.enabled = .f. mand4.enabled = .f. elseif recno("user")=1 thenmand1.enabled= .f.mand2.enabled= .f.mand3.enabled= .t.mand4.enabled= .t.elseif recno("user")=n then mand1.enabled = .t.mand2.enabled = .t.mand3.enabled = .f.mand4.enabled = .f. elsemand1.enabled = .t. mand2.enabled = .t. mand3.enabled = .t.mand4.enabled = .t. endifendifendifthisform.refresh4.4 表单保存按钮Click事件程序代码if empty(thisform.text1.value) then=messagebox("请输入用户名",0+48+0,"出错")thisform.text1.setfocusthisform.refreshreturnendifif empty(thisform.text2.value) then=messagebox("请输入密码",0+48+0,"出错")thisform.text2.setfocusthisform.refreshreturnendifif .not.(alltrim(thisform.text2.v alue) == alltrim(thisform.text3.value)) then=messagebox("密码重复错误,请重新输入",0+48+0,"出错")thisform.text2.value = ""thisform.text3.value = ""thisform.text2.setfocusthisform.refreshreturnendifif empty(bo1.value) then=messagebox("请选择所属部门",0+48+0,"出错")bo1.setfocusthisform.refreshreturnendififthisform.check1.value=0.and.thisf orm.check2.value=0.and.thisform.c heck3.value=0.and.thisform.check4 .value=0.and.thisform.check5.valu e=0 then=messagebox("至少选择一个用户权限",0+48+0,"出错")thisform.check1.setfocusthisform.refreshreturnendififthisform.check1.value=1.and.thisf orm.check2.value=1.and.thisform.c heck3.value=1.and.thisform.check4.value=1.and.thisform.check5.valu e=1 thenmesbox=messagebox("此用户将具有全部权限,请确认",4+48+0,"警告") if mesbox=7 thenthisform.check1.setfocusthisform.refreshreturnendifendif*用户权限处理PRIVATEnname,npassword,ndepartment,nkf,n xs,ncg,nkc,nxtnname = alltrim(thisform.text1.value) npassword =alltrim(thisform.text2.value) ndepartment = alltrim(bo1.value)if thisform.check1.value = 1 then nkf = .t.elsenkf = .f.endifif thisform.check2.value = 1 then nxs = .t.elsenxs = .f.endifif thisform.check3.value = 1 then ncg = .t.elsencg = .f.endifif thisform.check4.value = 1 thennkc = .t.elsenkc = .f.endifif thisform.check5.value = 1 thennxt = .t.elsenxt = .f.endif*判断是新记录保存还是修改记录If newcommand then && newcommand = .t. 是新记录保存locate for=alltrim(thisform.text1.value)if found() then=messagebox("用户已经存在",0+48+0,"出错")thisform.text1.setfocusthisform.refreshreturnendif*数据表user保存记录insert into user(name,password,department,kfg l,xsgl,cggl,kcgl,xtgl) values (nname,npassword,ndepartment,nkf, nxs,ncg,nkc,nxt)=messagebox("保存完毕",0+48+0,"提示")elseupdate user set password= npassword,department=ndepartment, kfgl=nkf,xsgl=nxs,cggl=ncg,kcgl=nkc,xtgl=nxt where name= nname=messagebox("修改完成",0+48+0,"提示")endif*表单初始化thisform.text1.enabled = .f. thisform.text2.enabled = .f. thisform.text3.enabled = .f. bo1.enabled = .f. thisform.check1.enabled = .f. thisform.check2.enabled = .f. thisform.check3.enabled = .f. thisform.check4.enabled = .f. thisform.check5.enabled = .f.mand1.enabled= .t.mand2.enabled = .t.mand3.enabled = .t.mand4.enabled = .t.mand5.enabled = .t.mand6.enabled = .t.mand7.enabled = .t.mand8.enabled = .t.mand9.enabled = .t.mand10.enabled =.f.mand11.enabled =.f.mand12.enabled= .t.bel5.visible = .f. thisform.text3.visible = .f.thisform.dis_reccommandthisform.dis_recordnewcommand = .f.thisform.refresh4.5 表单浏览按钮Click事件程序代码DEFINE WINDOW browsewin FROM 1,1TO 30,80 noFLOAT CLOSE nominimize nogrow nozoom systembrow fields name,department,kfgl,xsgl,cggl,kc gl window browsewin noappend nomodify nodeleterelease window browsewin2、图书管理表单TSGL.SCX代码5.1 自定义过程AUTO_BOOKID程序代码select bookset order to bookidgo bottomprivateautoid1,autoid2,autoid3,autoid4 autoid1 =alltrim(str(val(substr(alltrim(bo ok.bookid),2,6))+1,6,0))autoid2 = len(autoid1)if autoid2 != 6 thenfor n = autoid2 to 5autoid1 = "0" + autoid1 endforendifautoid4 = "B" + alltrim(autoid1) thisform.text1.value = autoid45.2 新建按钮Click事件程序代码thisform.text2.enabled = .t. thisform.text3.enabled = .t. thisform.text4.enabled = .t. thisform.text5.enabled = .t. thisform.text6.enabled = .t. bo1.enabled = .t.thisform.text7.enabled = .t. thisform.text8.enabled = .t.mand1.enabled = .f. mand2.enabled = .f. mand3.enabled = .f. mand4.enabled = .f. mand5.enabled = .f. mand6.enabled = .f. mand7.enabled = .f. mand8.enabled = .f. mand9.enabled = .f. mand10.enabled =.t. mand11.enabled =.t. mand12.enabled = .t.thisform.text2.value = ""thisform.text3.value = "" thisform.text4.value = "" thisform.text5.value = "" thisform.text6.value = "" bo1.value = "" thisform.text7.value = 0 thisform.text8.value = 0thisform.auto_bookidthisform.text2.setfocusthisform.newcommand = .t.thisform.refresh5.3 删除按钮Click事件程序代码if reccount("book")=1 then=messagebox("只有一条记录,不能删除",0+16+0,"出错")returnelsenbookid = alltrim(thisform.text1.value)nbookname = alltrim(thisform.text2.value)mesbox=messagebox("是否删除"+nbookid+"号图书",4+48+0,"警告") if mesbox=7 thenreturnelseuse book EXCLUSIVEdelete from book where bookid=nbookidpack=messagebox(nbookid+"图书已经删除",0+48+0,"提示")endifendifthisform.dis_recordthisform.dis_reccommandthisform.grid1.recordsource = "book"thisform.refresh5.4 保存按钮Click事件程序代码if empty(thisform.text2.value)=messagebox("请输入书名",0+48+0,"出错")thisform.text2.setfocusthisform.refreshreturnendifif empty(thisform.text3.value) =messagebox("请输入书号",0+48+0,"出错")thisform.text3.setfocusthisform.refreshreturnendifif empty(thisform.text4.value) =messagebox("请输入出版社",0+48+0,"出错")thisform.text4.setfocusthisform.refreshreturnendifif empty(thisform.text5.value) =messagebox("请输入作者信息",0+48+0,"出错")thisform.text5.setfocusthisform.refreshreturnendifif empty(bo1.value) =messagebox("请选择图书类型",0+48+0,"出错")bo1.setfocusthisform.refreshreturnendifif thisform.text7.value = 0=messagebox("请输入价格",0+48+0,"出错")bo1.setfocusthisform.refreshreturnendifPRIVATEnbookid,nbookname,nbookno,nbookph ouse,nbookwriter,nbookcd,nbookcla ss,nbookprice,nbookdiscountnbookid = alltrim(thisform.text1.value) nbookname = alltrim(thisform.text2.value) nbookno = alltrim(thisform.text3.value) nbookphouse = alltrim(thisform.text4.value) nbookwriter = alltrim(thisform.text5.value)nbookcd =alltrim(thisform.text6.value)nbookclass =alltrim(bo1.value)nbookprice = thisform.text7.value nbookdiscount = thisform.text8.value*判断是新记录保存还是修改记录If thisform.newcommand then && newcommand = .t. 是新记录保存*数据表book保存记录insert into book (bookid,bookname,bookno,bookphouse,bookwriter,bookcd,bookclass,bookprice,bookdiscount) values (nbookid,nbookname,nbookno,nbookphouse,nbookwriter,nbookcd,nbookclass,nbookprice,nbookdiscount)=messagebox("保存完毕",0+48+0,"提示")elseupdate book set bookname=nbookname,bookno=nbookno ,bookphouse=nbookphouse,bookwrite r=nbookwriter,bookcd=nbookcd,book class=nbookclass,bookprice=nbookp rice,bookdiscount=nbookdiscount where bookid=nbookid=messagebox("修改完成",0+48+0,"提示")endif*表单初始化thisform.text2.enabled = .f. thisform.text3.enabled = .f.thisform.text4.enabled = .f. thisform.text5.enabled = .f. thisform.text6.enabled = .f. bo1.enabled = .f. thisform.text7.enabled = .f. thisform.text8.enabled = .f.mand5.enabled = .t. mand6.enabled = .t. mand7.enabled = .t. mand8.enabled = .t. mand9.enabled = .t. mand10.enabled =.f. mand11.enabled =.f. mand12.enabled = .t.thisform.dis_recordthisform.dis_reccommandthisform.newcommand = .f. thisform.refresh5.5 浏览按钮Click事件程序代码DEFINE WINDOW browsewin FROM 1,1 TO 30,160 noFLOAT CLOSE nominimize nogrow nozoom systembrow fields bookid,bookname,bookno,bookphouse ,bookwriter,bookcd,bookclass,book price,bookdiscount window browsewin noappend nomodify nodeleterelease window browsewin3、会员输入表单KFGL_HYSR.SCX程序代码6.1 自定义过程AUTO_VIPID程序代码select vipset order to vipidgo bottomprivateautoid1,autoid2,autoid3,autoid4 autoid1 = alltrim(str(val(substr(alltrim(vi p.vipid),2,6))+1,6,0))autoid2 = len(autoid1)if autoid2 != 6 thenfor n = autoid2 to 5autoid1 = "0" + autoid1endforendifautoid4 = "V" + alltrim(autoid1) thisform.text1.value = autoid46.2 保存按钮Click事件程序代码*输入数据校验if empty(thisform.text2.value)=messagebox("请输入会员姓名",0+16+0,"出错")thisform.text2.setfocusreturnendifif thisform.optiongroup1.value = 0 =messagebox("请选择会员性别",0+16+0,"出错")thisform.optiongroup1.option1.set focusreturnelseprivate nvipsexstore "" to nvipsexif thisform.optiongroup1.value = 1store "男" to nvipsexelsestor "女" to nvipsexendifendifif empty(thisform.text4.value)=messagebox("请输入会员联系地址",0+16+0,"出错")thisform.text4.setfocusreturnendifif empty(thisform.text5.value)=messagebox("请输入会员联系电话",0+16+0,"出错")thisform.text5.setfocusreturnendifif empty(thisform.text6.value)=messagebox("请输入邮政编码",0+16+0,"出错")thisform.text6.setfocusreturnendif*保存数据privatenvipid,nvipname,nvipadd,nvipphone ,nvipcodenvipid = alltrim(thisform.text1.value)nvipname = alltrim(thisform.text2.value) nvipadd = alltrim(thisform.text4.value) nvipphone = alltrim(thisform.text5.value) nvipcode = alltrim(thisform.text6.value)insert into vip (vipid,vipname,vipsex,vipadd,vipp hone,vipcode,vipsum,vipdiscount) values(nvipid,nvipname,nvipsex,nvipadd, nvipphone,nvipcode,0,0)=messagebox("保存成功",0+48+0,"提示")nmesbox=messagebox("是否打印会员卡?",4+32+0,"会员卡打印")if nmesbox = 6selectvip.vipid,vip.vipname,vip.vipsex, vip.vipadd,vip.vipphone,vip.vipco de from vip where vip.vipid = nvipid into cursor vipcardselect vipcardreport form vipcard.frx to print use in vipcardendifthisform.auto_vipidmand2.click6.3 清除按钮Click事件程序代码thisform.text2.value = ""thisform.optiongroup1.value = 0 thisform.text4.value = "" thisform.text5.value = "" thisform.text6.value = ""thisform.text1.setfocusthisform.refresh4、会员查询表单KFGL_HYCX.SCX程序代码7.1 表单自定义过程DIS_GRID程序代码thisform.grid1.readonly = .t. thisform.grid1.columncount = 8 thisform.grid1.column1.header1.caption = "会员编号"thisform.grid1.column1.width = 80 thisform.grid1.column1.movable= .f.thisform.grid1.column1.resizable = .f.thisform.grid1.column2.header1.ca ption = "会员姓名"thisform.grid1.column2.width = 80 thisform.grid1.column2.movable= .f.thisform.grid1.column2.resizable = .f.thisform.grid1.column3.header1.ca ption = "会员性别"thisform.grid1.column3.width = 80thisform.grid1.column3.movable= .f.thisform.grid1.column3.resizable = .f.thisform.grid1.column4.header1.ca ption = "联系地址"thisform.grid1.column4.width = 250 thisform.grid1.column4.movable= .f.thisform.grid1.column4.resizable = .f.thisform.grid1.column5.header1.ca ption = "联系电话"thisform.grid1.column5.width = 80 thisform.grid1.column5.movable= .f.thisform.grid1.column5.resizable = .f.thisform.grid1.column6.header1.ca ption = "邮政编码"thisform.grid1.column6.width = 80 thisform.grid1.column6.movable= .f.thisform.grid1.column6.resizable = .f.thisform.grid1.column7.header1.ca ption = "累计购书金额"thisform.grid1.column7.width = 80 thisform.grid1.column7.movable= .f.thisform.grid1.column7.resizable = .f.thisform.grid1.column8.header1.ca ption = "会员优惠折扣"thisform.grid1.column8.width = 80 thisform.grid1.column8.movable= .f.thisform.grid1.column8.resizable = .f.thisform.refresh7.2 表单Init过程程序代码thisform.dis_gridpublicncombo1,ncombo2,ntext1,chsql,cxsq lstore "" toncombo1,ncombo2,ntext1,chsql,cxsqlthisform.optiongroup1.value = 0 thisform.optiongroup1.enabled= .f.thisform.grid1.recordsource = Null selectvip.vipid,vip.vipname,vip.vipsex, vip.vipadd,vip.vipphone,vip.vipco de,vip.vipsum,vip.vipdiscountfrom vip into cursor hycx_temptable order by vip.vipidthisform.grid1.recordsource = "hycx_temptable"thisform.dis_gridthisform.refresh7.3 表单添加条件按钮Click事件程序代码ifempty(bo1.value) .or. empty(bo2.value) .or. empty(thisform.text1.value)=messagebox("请输入条件",0+48+0,"出错")bo1.setfocusreturnendifif thisform.optiongroup1.value = 1 chsql = " AND "endifif thisform.optiongroup1.value = 2chsql = " OR "endifchsql = chsql + ncombo1 + ncombo2 + ntext1thisform.edit1.value = thisform.edit1.value + chsqlif .not.empty(thisform.edit1.valu e)thisform.optiongroup1.value = 1 thisform.optiongroup1.enabled = .t.endifbo1.value = "" bo2.value = ""thisform.text1.value = ""chsql = ""bo1.setfocus thisform.refresh7.4 表单条件查询按钮Click事件程序代码if empty(thisform.edit1.value) =messagebox("请输入查询条件",0+16+0,"出错")mand1.setfocusthisform.refreshreturnendif。
网上书店完整代码
附录全部源代码package class Connect {private static Connection con = null;private static String url=jdbc:oracle:thin:@localhost:1521:ORCL;private static String driver = \;private static String user = scott;private static String pwd = iger;public static Connection getConnection(){try{(driver);con = (url, user, pwd);数据库连接成功!);} catch (ClassNotFoundException e) {驱动加栽失畋!);;} catch (SQLException e) {);数据库连接失败!} return con; } public static void main(String[] args) { (); }} package class docMenuAction implements ActionListener { RegisterFrame register =null; JPanel cusPanel = null; JPanel docPanel = null;public docMenuAction(RegisterFramG register){=register;—•-9—•Jpublic void actionPerformed(ActionEvent e) {于用户搜索商品public ArrayList getAllSellerGoods(){ArrayList list = new ArrayList();conn =();try{stateme nt =();String sql = select * from goods a,seller b where =;resultSet = (sql);while()){Seller seller = new Seller();(seller^ name));(address));Goods goods = new Goods();(seller);(goodsjd));(goods _n ame));(disco unt));um)); (Price));2012-9-192012-9-192012-9-192012-9-19etlmage());(null);(null);(false);etlmage());(600, 400);■/(null);(menuBao;setGoodsPanel();■t(goodsPa nel,;setSouthPa nel();setOrderPanel();(southPanel,;}quals())){泯泠?勘请输入商品编号或商品数量!);}else{int id =());int num = ((String) ());goods = (id);晚隈泠?勘您确定要购买吗)==0){讦()==0){泯泠?妙商品编号输入错误!);}else{if()<num){泯泠?妙商品数量不足!);}else{()-num);(goods);OrderDao order = new OrderDao();浪泠?勘购买成功!);setAr();setOr();0;}}}else{}}}});}etName();3r(i][7]=().getAddress();}} private void setArNull(){ for(int i=O;i<;i++){for(int j=O;j<ar[i].length;j++){ ar[i][j]=\;etName();or[i][3]=().getPrice();or[i][4]=().getDiscount();or[i][5]=().getPrice()*().getDiscount()*;or[i][6]=();or[i][7]=().getName();or[i][8]=().getAddress();} } private void setOrNull(){for(int i=O;i<;i++){for(int j=0;j<or[i].length;j++){ or[i][j]=\;}} }public static void main (String!) args) { BuyerFrame frame = new BuyerFrame();(true);}package class LoginFrame extends JFrame{抽癩瑯??抱決咗数杳浮?撇支?渠睥?慌敢?用户名:);抽癞f師??抱技潔扌巢慌敢??敝??抱注龙密码:);private JPasswordField pws = new JPasswordField();抽癩獅??牠注地淀?抱洼?渠睥?慌敢?角色:);抽癞砸??涪潢湿?i稍敬湿??敲??涪潢淡?蔽?球械柿崙叨商家?买家});抽癞砸??璜潴?珞?渠睥?畋毀湯龙确定);抽癩獅??璜潴?珞??蔽??瑾潴?取消);private String flag = null;public LoginFrame(){init();}private void init(){(320, 280);登录);龙(new lmagelcon(images/).getlmage());(null);(false);■/(null);(40, 20,150, 30);(userNameLabel);(120, 20, 150, 30);(useNameText);(40, 80, 150, 30);(pwdLabel); (120, 80, 150, 30); (pws);(40, 140, 70, 30);(roleLabel);(120,140, 150z 30);(roleBox);(40, 200, 70, 30);(btR);(new ActionListener() {(©Overridepublic void actionPerformed(ActionEvent e) {quals(f)){ flag = seller;} .equals(f)){ 晚龙买家flag = customer;}if(seller.equals(flag)){Seller seller = (), ()););}else{ --+()); if()==null){ 泯泠?擀用户名或密码输入错误setVisible(false);SellerFrame fame = new SellerFrame();(true);}if(customer.equals(flag)){Buyer buyer =(),());泯泠?妙用户名或密码输入错误);}else{setVisible(false);BuyerFrame frame = new BuyerFrame();(true);2012-9-20etlmage());(300, 400); etlmage());(600, 400);■f(null);(me nuBar;;setGoodsPanel();■/(goodsPa nel,;setSouthPanel();setOrderPanel();(southPanel,;}quals{))){泯泠?勘请输入商品编号!);}else{int id =());UpdateFrame frame = new UpdateFrame();Goods goods = new GoodsDao().getOneGoods(id); if()!=0){ (goods);(goods);(true);}else{浪泠?勘商品编号输入错误!);} });(btDelet);quals())){隈泠?妙请输入商品编号!);}else{int id =());GoodsDao dao = new GoodsDaof);晩隈泠?勘您确宦要删除吗)==0){if(id)!=O){浪泠?妙删除成功!);}else{隈泠?勘商品编号输入错误!!);}}else{} }} });(btAdd);(new ActionListener() {@Overridepublic void actionPerformed(Acti on Eve nt e) { etName();ar[i]⑺=().getAddress();} Jprivate void setArNull(){for(int i=0;i<;i++){for(int j=O;j<ar[i].length;j++){ar[i][j]=\;}} }etName(); or[i][3]=().getPrice(); or[i][4]=().getDiscount(); or[i][5]=().getPrice()*().getDiscount()#;or[i][6]=();or[i][7]=();}}private void setOrNull(){for(int i=0;i<;i++){ for(int j=0;j<or[i].length;j卄){or[i][j]=\;public static void main (String!] args) { SellerFrame frame = new SellerFrame();(true);class UpdateFrame extends JFrame{packageprivate static final Goods Goods = null;抽癩獅??抱注氟iliL浮??蔽??抱注龙商品名:);抽癩獅??抱注氤僦械散?渠睥?慌敢?价格:);抽癞瑚??抱注氤?猱涸浚??敵??抱注龙折扣:);抽癞瑚??抱注氤虬澎?渠睥?慌敢?数量:);private JTextField fieldName = new JTextField(20);private JTextField fieldPrice = new JTextField(2O); private JTextField fieldDiscount = new JTextField(2O); private JTextField fieldNum = new JTextField(2O);轴癩f師??璜潴?珞沓敲?渠睥?畋毀湯龙修改);抽癩獅??璜潴?珞憐据波?渠睥?畋毀湯茏取消); private Goods goods = new Goods();public UpdateFrame(){init();private void init(){(320z 330););龙修改商品信息(new lmagelcon(images/).getlmage());(null);(null); (false);// ;(null);setText(goods); setContentPanel();}private void setContentPanel(){(30, 30, 80, 30);(130, 30, 150, 30);(30, 90, 80, 30);(30, 150, 80, 30);(130, 150, 150, 30);(30, 200, 80, 30);(130, 200, 150, 30);(30, 250, 70, 30);(210, 250, 70, 30);(IbName);(fieldName);(IbPrice);(fieldPrice);(IbDiscount);(fieldDisco unt);(IbNum);(fieldNum);(btCancel);(btSure);(new ActionListener() {@Override public void actionPerformed(ActionEvent e) { // TODO Auto-generatedmethod stub setVisible(false); }});(nww ActionListener() {@Overridepublic void actionPerformed(Acti on Eve nt e) {//TODO Auto-generated method stub晩隈泠?妙您确定耍修改吗)==0){ GoodsDao dao = new GoodsDao();()));());()));()));(goods);setVisible(false);隈泠?勘修改成功! );}else{//}}});} public void setText(Goods goods){0);()));()));()));} public Goods getGoods() { return goods; } public void setGoods(Goods goods) { goods; } public static void main(String[] args) { UpdateFrame frame = new UpdateFrame(); (true); }}数据库SQL语句:create table seller(seller^ name varchar2(2O),pwd varchar2(20),address varchar2(200))insert into seller valuesf'niclascage'/长理专卖店'/1234567湖南长沙')select * from sellerdrop table sellercommitcreate table buyerfbuyerjd varchar(2O) primary key,buyer_ name varchar(2O)zpwd varchar2(2O)/address varchar(2OO))insert into buyer values(l lina'/林大专卖店7123456'/湖南长沙')select * from buyerdrop table buyercreate table goods(goodsjd int primary key,sellerjd varchar(20),goods _n ame varcharfSO),price int,discount int,num int,constraint fk_sellerjd foreign key(sellerjd) references seller(seller_id))insert into goods valuesfl/niclascage'/Java'^O^^O)・select * from goodsdrop table goodscreate table orders(orderjd int primary key,goodsjd int,sellerjd varchar(20),buyerjd varchar(20)znum int,constraint fk_goodsjd foreign key(goodsjd) references goods(goods_id), constraint fk_sellers_id foreign key(sellerjd) references seller(sellerjd)z constraint fk_buyerjd foreign key(buyerjd) referencesbuyer(buyerjd))select * from orders insert into orders values(l/l/niclascage,/,lina,/2)drop table orders; drop table goods; drop table buyer; drop table seller;。
第8章网上书店实例
建立connection对象
Conn.asp文件源代码
2.用户注册 登录的用户必须是先经过注册过的,注册的目的是一方面确 认用户的身份,另一方面录入用户的有用信息,以便在电子 商务活动中能有效地进行。 用户注册的界面如下:
生成用户注册界面的文件为regist.htm, regist.htm文件通
Login.asp文件源代码
在上例中的session(“username”)=rs1(“LoginName”)是为建立一 个session对象保存登录用户名于客户端的浏览器中,以方便
后续网页对登录用户的验证。
通过server.mappath()函数获取 Login.asp文件中的<!--#include file=“./conn.asp” -->语句为包
自动编号 文本 50 书籍的基本介绍 文本 20 文本 20 数字 文本 250 数字 数字
出版社
书价 说明 库存量(整型) 借出数(整型)
二、书籍管理程序
1.图书浏览
本部分主要完成对书籍数据的浏览操作,其用户界面如下图
生成recordset对象 对应主要程序如下(程序名为:booklist1.asp) set rs1=server.CreateObject("adodb.recordset") rs1.Open "select * from books",cn,1,1 初始化当前记录数· 定义每页记录数 rs1.PageSize=15 record_index=0 读取页码参数 dim currec currec=int(Request.QueryString("move")) if currec<1 then 页码超出范围时的处理 currec=1 end if if cuurec>=rs1.PageCount then currec=rs1.PageCount 定位页码与当前记录 end if rs1.AbsolutePage =currec record_index=(currec-1)*rs1. booklist1.asp文件部分源代码
ASPNET网上书店信息管理系统(附源代码)
目录1 选题背景 (1)1.1 设计内容 (1)1.2 目的和意义 (1)2 方案论证 (1)2.1 B/S结构介绍 (1)2.2 基于B/S模式系统的实现技术 (2)2.3 运行环境和开发工具的选择 (3)2.4数据库SQL Server的选择 (4)3. 过程论述 (4)3.1 需求分析 (4)3.2 网上书店的总体设计 (4)4 设计结果 (8)4.1 运行主界面 (8)4.2 用户注册页面 (9)4.3 用户登陆页面 (9)4.4 修改密码页面 (10)4.5 图书搜索界面 (10)4.6 购买页面 (11)4.7 图书评价界面 (11)5 设计体验及今后改进意见 (12)5.1 设计体会 (12)5.2 改进意见 (12)参考文献 (13)Web数据库程序设计语言课程设计1 选题背景1.1 设计内容20世纪末,随着计算机科学的发展,数据库技术在Internet中的应用越来越广泛,为广大网络用户提供了更加周到和人性化的服务。
个性化已逐渐成为当今Web应用的潮流。
本文研究了一种基于数据关联规则网上书店系统,此方案与现今网上已采用的一些方案相比,具有用户使用更简单、界面更直观等优点。
网上书店在我国刚起步,但发展很快。
随着我国互联网的更加普及和网上书店的更趋成熟,会有越来越大的消费群体,市场潜力会得到充分发挥。
网上书店正是依靠Internet这个载体才得以发展和不断的成熟起来,并对产品的销售和物品的购买展示出了一种崭新的理念。
1.2 目的和意义网上书店管理系统主要是处理网上购书和库存的系统,提供具有图书分类检索和搜索,购物车管理,在线订单,书籍推荐,热卖排行,顾客评论等功能和强大的后台管理功能,提供高效、安全、智能化的数据管理,从而提高整个网上书店各项功能管理水平。
通过网上书店管理系统,可以做到信息的规范管理、科学统计和快速查询,从而减少管理方面的工作量,有效地提高网上购书的效率。
2 方案论证2.1 B/S结构介绍B/S结构(Browser/Server结构)结构,即浏览器和服务器结构。
网上书店管理系统附程序源代码.doc
1)书图查询: 当客户进入网上书店时,应该在主页面中分类显示最新的书目信息,以供客户选择所需图书,同时也应该提供按照图书名称,或者作者信息快速查询所需书目信息的功能。
2)购物车管理:当客户选择购买某图书产品时,应该能够将对应图书信息,如:价格、数量记录到对应的购物车中,并允许客户返回书目查询页面,选择其他商品,并添加到购物车中,当对应的购物订单生成后,应该能够自动清除以生成订单的购物车中的信息。
con=pool.getConnection();//前台调用存储过程
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("show");
数据库表数据删除存储过程代码:
CREATE PROCEDURE del_u @id int
二、
1)采用人机对话的操作方式,界面设计美观友好、信息查询灵活、方便、快捷、准确、数据存储安全可靠。
2)全面展示商城内所有商品。
3)为顾客提供一个方便、快捷的商品信息查询功能。采用模糊查询查询数据。
4)会员可以随时修改自己的会员资料。
5)实现网上购物。
6)查看商城内的公告信息。
7)用户随时都可以查看自己的订单。
用户登陆网站浏览图书。
用户在主页或我的帐户中注册成为网站的会员。
只有网站的会员才能在网站购买图书。
用户可以通过分类浏览,书目推荐,新书推荐,书目查询的方式选择喜爱的图书。
用户选择图书提交订单完成订购。
2)后台管理子系统为书店管理员提供了管理网络书店的平台。属于后台管理部分的设计。具体功能如下:
注册会员的管理,并通过会员的消费记录更改的会员的等级,不同等级的会员享受不同的购书折扣待遇。图书类别的管理,图书的管理。通过添加,修改,删除对图书类别进行管理。
51aspx源码必读
║ 2) 转载本站提供的资源请勿删除本说明文件。 ║
║ 3) 本站源码为网上搜集或网友提供,如果涉及或侵害到您的版║
║ 权,请立即写信通知我们。 ║
║ 4) 本站提供代码只可供研究学习使用,切勿用于商业用途, ║
║ 由此引起一切后果与本站无关。 ║
║ 5) 源码后续升级或修补,我们会在该源码评论中发布! ║
║ ║
(后台)图书、用户的添加,删除,修改等操作,查看客户的订单及修改
该项目采用三层结构开发;实现数据库访问;SiteMapPath、TreeView、Menu实现系统的导航,
母版页、框架控制整体部局;GridView、DatailsView、DataList展示页面;XML技术实现RSS发布;
关于源码使用常见问题及解决方案,请参阅:/showforum-9.html
╰══┤ 源码网 ├══╯
╰───────────────────────╯
友情提示:
一般数据库文件默认在DB_51aspx文件夹下
如果使用VS2005打开本站项目文件,建议打开前务必安装VS2005Sp1
║ 本站专注于源码下载 ║
║ 联系方式 : support@ ║
║ ╭───────────────────────╮ ║
使用了FreeTextBox、日期等第三方控件;验证控件和JavaScript实现页面的验证功能;
HttpHandler实现用户头像的水印效果;使用AJAX技术改善用户体验。
数据库在DB_51aspx文件夹中,附加即可。 登陆用户名和密码是51apx 作者:wxc501
源码下载及讨论地址:/CV/MyBookShopWeb
网上书店完整代码
附录全部源代码package com.shoeShop.db;import java.sql.Connection;import java.sql.DriverManager;import java.sql.SQLException;public class Connect {private static Connection con = null;private static String url="jdbc:oracle:thin:@localhost:1521:ORCL";private static String driver = "oracle.jdbc.driver.OracleDriver";private static String user = "scott";private static String pwd = "tiger";public static Connection getConnection(){try {Class.forName(driver);con = DriverManager.getConnection(url, user, pwd);System.out.println("数据库连接成功!");} catch (ClassNotFoundException e) {System.out.println("驱动加载失败!");;} catch (SQLException e) {System.out.println("数据库连接失败!");}return con;}public static void main(String[] args) {Connect.getConnection();}}package com.shoeShop.action;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JPanel;import com.shoeShop.view.RegisterFrame;public class docMenuAction implements ActionListener { RegisterFrame register = null;JPanel cusPanel = null;JPanel docPanel = null;public docMenuAction(RegisterFrame register){ this.register = register;this.cusPanel = register.cusPanel;this.docPanel = register.docPanel;}public void actionPerformed(ActionEvent e) {// TODO Auto-generated method stubregister.flag = 1;//System.out.println(register.flag);register.remove(cusPanel);register.add(docPanel);docPanel.updateUI();}}package com.shoeShop.dao;import java.sql.Connection;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;import com.shoeShop.db.Connect;import com.shoeShop.entity.Buyer;import com.shoeShop.entity.Seller;public class BuyerDao {private static Connection conn;private static Statement statement;private static ResultSet resultSet;//插入数据,用于注册public int insertBuyer(Buyer buyer){int flag = 0;conn = Connect.getConnection();try {statement = conn.createStatement();String sql = "insert into buyer values('"+buyer.getId()+"','"+buyer.getName()+"','"+buyer.getPwd()+"','"+buyer.getAddress()+"')" ;// System.out.println("buyer"+sql);flag = statement.executeUpdate(sql);statement.close();conn.close();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}// System.out.println(flag);return flag;}//通过用户名和密码查询,用于登录public static Buyer getBuyer(String name,String pwd){conn = Connect.getConnection();Buyer buyer = new Buyer();try {statement = conn.createStatement();String sql = "select * from buyer where buyer_id='"+name+"' and pwd = '"+pwd+"'";resultSet = statement.executeQuery(sql);while(resultSet.next()){buyer.setId(resultSet.getString("buyer_id"));buyer.setName(resultSet.getString("buyer_name"));buyer.setPwd(resultSet.getString("pwd"));buyer.setAddress(resultSet.getString("address"));}resultSet.close();statement.close();conn.close();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}return buyer;}public static void main(String[] args) {BuyerDao dao = new BuyerDao();System.out.println(dao.getBuyer("zxk", "654321")); // Buyer buyer = new Buyer();// buyer.setId("lily");// buyer.setName("长理专卖");// buyer.setPwd("123456");// buyer.setAddress("湖南长沙");// dao.insertBuyer(buyer);}}package com.shoeShop.dao;import java.sql.Connection;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;import java.util.ArrayList;import com.shoeShop.db.Connect;import com.shoeShop.entity.Goods;import com.shoeShop.entity.Seller;import er;public class GoodsDao {private static Connection conn;private static Statement statement;private static ResultSet resultSet;//查询登录商家的所有商品,用于商家管理自己的商品public ArrayList getAllGoods(){ArrayList list = new ArrayList();conn = Connect.getConnection();try {statement = conn.createStatement();String sql = "select * from goods a,seller b where a.seller_id=b.seller_id and b.seller_id='"+User.getUserName()+"'";resultSet = statement.executeQuery(sql);while(resultSet.next()){Seller seller = new Seller();seller.setName(resultSet.getString("seller_name"));seller.setAddress(resultSet.getString("address"));Goods goods = new Goods();goods.setSeller(seller);goods.setId(resultSet.getInt("goods_id"));goods.setName(resultSet.getString("goods_name"));goods.setSeller_id(resultSet.getString("seller_id"));goods.setDiscount(resultSet.getInt("discount"));goods.setNum(resultSet.getInt("num"));goods.setPrice(resultSet.getInt("price"));// System.out.println(goods.toString());list.add(goods);}} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}finally{try {resultSet.close();statement.close();conn.close();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}return list;}public ArrayList getAllSellerGoods(){ArrayList list = new ArrayList();conn = Connect.getConnection();try {statement = conn.createStatement();String sql = "select * from goods a,seller b where a.seller_id=b.seller_id";resultSet = statement.executeQuery(sql);while(resultSet.next()){Seller seller = new Seller();seller.setName(resultSet.getString("seller_name"));seller.setAddress(resultSet.getString("address"));Goods goods = new Goods();goods.setSeller(seller);goods.setId(resultSet.getInt("goods_id"));goods.setName(resultSet.getString("goods_name"));goods.setSeller_id(resultSet.getString("seller_id"));goods.setDiscount(resultSet.getInt("discount"));goods.setNum(resultSet.getInt("num"));goods.setPrice(resultSet.getInt("price"));// System.out.println(goods.toString());list.add(goods);}} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}finally{try {resultSet.close();statement.close();conn.close();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}return list;}//根据商品号查询商品信息public Goods getOneGoods(int id){Goods goods = new Goods();conn = Connect.getConnection();try {statement = conn.createStatement();String sql = "select * from goods where goods_id = "+id;resultSet = statement.executeQuery(sql);while(resultSet.next()){goods.setId(id);goods.setName(resultSet.getString("goods_name"));goods.setPrice(resultSet.getInt("price"));goods.setNum(resultSet.getInt("num"));goods.setDiscount(resultSet.getInt("discount"));goods.setSeller_id(resultSet.getString("seller_id"));goods.setNum(resultSet.getInt("num"));}} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}finally{try {resultSet.close();statement.close();conn.close();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}return goods;}//修改商品信息public int updateGoods(Goods goods){int flag = 0;conn = Connect.getConnection();try {statement = conn.createStatement();String sql = "update goods set goods_name='"+goods.getName()+"',price ="+goods.getPrice()+",discount ="+goods.getDiscount()+",num="+goods.getNum()+" where goods_id="+goods.getId();flag = statement.executeUpdate(sql);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}finally{try {statement.close();conn.close();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}return flag;}//通过id删除商品public int deleteById(int id){int flag = 0;conn = Connect.getConnection();try {statement = conn.createStatement();String sql = "delete goods where goods_id = "+id;flag = statement.executeUpdate(sql);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}finally{try {statement.close();conn.close();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}return flag;}//添加public int insertGoods(Goods goods){int flag = 0;conn = Connect.getConnection();try {statement = conn.createStatement();String sql = " insert into goods values((select max(goods_id+1) from goods),'"+User.getUserName()+"','"+goods.getName()+"',"+goods.getPrice()+","+goods.getDisco unt()+","+goods.getNum()+")";flag = statement.executeUpdate(sql);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}finally{try {statement.close();conn.close();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}return flag;}public static void main(String[] args) {GoodsDao dao = new GoodsDao();// Goods goods = new Goods();// goods.setName("c++");// goods.setPrice(50);// User.setUserName("niclascage");// goods.setDiscount(8);// goods.setNum(10);// System.out.println("main");// System.out.println("ii"+dao.insertGoods(goods)); // System.out.println(dao.deleteById(4));// Goods goods = new Goods();// goods.setId(1);// goods.setName("oracle");// goods.setPrice(50);// goods.setDiscount(8);// goods.setNum(5);// System.out.println(dao.updateGoods(goods));dao.getAllSellerGoods();// System.out.println(dao.getOneGoods(1));}}package com.shoeShop.dao;import java.sql.Connection;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;import java.util.ArrayList;import com.shoeShop.db.Connect;import com.shoeShop.entity.Goods;import com.shoeShop.entity.Order;import com.shoeShop.entity.Seller;import er;public class OrderDao {private static Connection conn;private static Statement statement;private static ResultSet resultSet;//插入public int inserOerderByGoods(Goods goods, int num){int flag = 0;conn = Connect.getConnection();try {statement = conn.createStatement();String sql = "insert into orders values((select max(order_id+1) from orders),"+goods.getId()+",'"+goods.getSeller_id()+"','"+User.getUserName()+"',"+num+")";flag = statement.executeUpdate(sql);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}finally{try {statement.close();conn.close();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}return flag;}//查询登录用户的所有订单public ArrayList getOrder(){ArrayList list = new ArrayList();conn = Connect.getConnection();try {statement = conn.createStatement();String sql = "select * from orders a,seller b,goods c where a.seller_id=b.seller_id and a.goods_id=c.goods_id and a.buyer_id = '"+User.getUserName()+"'";resultSet = statement.executeQuery(sql);while(resultSet.next()){Order order = new Order();Goods goods = new Goods();Seller seller = new Seller();order.setId(resultSet.getInt("order_id"));order.setNum(resultSet.getInt("num"));order.setGoods_id(resultSet.getInt("goods_id"));goods.setId(resultSet.getInt("goods_id"));goods.setPrice(resultSet.getShort("price"));goods.setPrice(resultSet.getInt("price"));goods.setDiscount(resultSet.getInt("discount"));goods.setName(resultSet.getString("goods_name"));seller.setName(resultSet.getString("seller_name"));seller.setAddress(resultSet.getString("address"));order.setSeller(seller);order.setGoods(goods);// System.out.println(order.toString());list.add(order);}} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}finally{try {resultSet.close();statement.close();conn.close();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}return list;}//查询登录商家的所有订单public ArrayList getSellerOrder(){ArrayList list = new ArrayList();conn = Connect.getConnection();try {statement = conn.createStatement();String sql = "select * from orders a,seller b,goods c where a.seller_id=b.seller_id " +"and a.goods_id=c.goods_id and a.seller_id= '"+User.getUserName()+"'";resultSet = statement.executeQuery(sql);while(resultSet.next()){Order order = new Order();Goods goods = new Goods();Seller seller = new Seller();order.setId(resultSet.getInt("order_id"));order.setNum(resultSet.getInt("num"));order.setGoods_id(resultSet.getInt("goods_id"));order.setBuyer_id(resultSet.getString("buyer_id"));goods.setId(resultSet.getInt("goods_id"));goods.setPrice(resultSet.getShort("price"));goods.setPrice(resultSet.getInt("price"));goods.setDiscount(resultSet.getInt("discount"));goods.setName(resultSet.getString("goods_name"));seller.setName(resultSet.getString("seller_name"));seller.setAddress(resultSet.getString("address"));order.setSeller(seller);order.setGoods(goods);list.add(order);}} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}finally{try {resultSet.close();statement.close();conn.close();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}return list;}public static void main(String[] args) {OrderDao dao = new OrderDao();dao.getOrder();}}package com.shoeShop.dao;import java.sql.Connection;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;import com.shoeShop.db.Connect;import com.shoeShop.entity.Seller;public class SellerDao {private static Connection conn;private static Statement statement;private static ResultSet resultSet;//插入数据,用于注册public int insertSeller(Seller seller){int flag = 0;conn = Connect.getConnection();try {statement = conn.createStatement();String sql = "insert into seller values('"+seller.getId()+"','"+seller.getName()+"','"+seller.getPwd()+"','"+seller.getAddress()+"')";flag = statement.executeUpdate(sql);statement.close();conn.close();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}return flag;}//通过用户名和密码查询,用于登录public static Seller getSeller(String name,String pwd){conn = Connect.getConnection();Seller seller = new Seller();try {statement = conn.createStatement();String sql = "select * from seller where seller_id='"+name+"' and pwd = '"+pwd+"'";resultSet = statement.executeQuery(sql);while(resultSet.next()){seller.setId(resultSet.getString("seller_id"));seller.setName(resultSet.getString("seller_name"));seller.setPwd(resultSet.getString("pwd"));seller.setAddress(resultSet.getString("address"));}resultSet.close();statement.close();conn.close();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}return seller;}public static void main(String[] args) {SellerDao dao = new SellerDao();// System.out.println(dao.getSeller("蒋斌", "654321"));// Seller seller = new Seller();// seller.setId("lily");// seller.setName("长理专卖");// seller.setPwd("123456");// seller.setAddress("湖南长沙");// dao.insertSeller(seller);}}package com.shoeShop.entity; /***功能:商家实体类* @author:蒋斌*2012-9-19下午4:17:40*/public class Buyer {private String id;private String name;private String address;private String pwd;public String getPwd() {return pwd;}public void setPwd(String pwd) {this.pwd = pwd;}public String getId() {return id;}public void setId(String id) {this.id = id;}public String getName() {return name;}public void setName(String name) { = name;}public String getAddress() {return address;}public void setAddress(String address) { this.address = address;}@Overridepublic String toString() {return "Buyer [id=" + id + ", name=" + name + ", address=" + address + "]";}}package com.shoeShop.entity;/****功能:商品实体类* @author:蒋斌*2012-9-19下午4:26:05*/public class Goods {private int id;private String seller_id;private Seller seller;private String name;private int price;private int discount;private int num;public Seller getSeller() {return seller;}public void setSeller(Seller seller) { this.seller = seller;}public int getDiscount() {return discount;}public void setDiscount(int discount) { this.discount = discount;}public int getNum() {return num;}public void setNum(int num) {this.num = num;}public int getId() {return id;}public void setId(int id) {this.id = id;}public String getSeller_id() {return seller_id;}public void setSeller_id(String seller_id) {this.seller_id = seller_id;}public String getName() {return name;}public void setName(String name) { = name;}public int getPrice() {return price;}public void setPrice(int price) {this.price = price;}@Overridepublic String toString() {return "Goods [id=" + id + ", seller_id=" + seller_id + ", seller="+ seller + ", name=" + name + ", price=" + price+ ", discount=" + discount + ", num=" + num + "]";}}package com.shoeShop.entity; /****功能:订单实体类* @author:蒋斌*2012-9-19下午4:26:24*/public class Order {private int id;private int goods_id;private String seller_id;private String buyer_id;private Goods goods;private Seller seller;private Buyer buyer;private int num;public int getNum() {return num;}public void setNum(int num) {this.num = num;}public Goods getGoods() {return goods;}public void setGoods(Goods goods) { this.goods = goods;}public Seller getSeller() {return seller;}public void setSeller(Seller seller) { this.seller = seller;}public Buyer getBuyer() {return buyer;}public void setBuyer(Buyer buyer) { this.buyer = buyer;}public int getId() {return id;}public void setId(int id) {this.id = id;}public int getGoods_id() {return goods_id;}public void setGoods_id(int goods_id) {this.goods_id = goods_id;}public String getSeller_id() {return seller_id;}public void setSeller_id(String seller_id) {this.seller_id = seller_id;}public String getBuyer_id() {return buyer_id;}public void setBuyer_id(String buyer_id) {this.buyer_id = buyer_id;}@Overridepublic String toString() {return "Order [id=" + id + ", goods_id=" + goods_id + ", seller_id="+ seller_id + ", buyer_id=" + buyer_id + ", goods=" + goods+ ", seller=" + seller + ", buyer=" + buyer + ", num=" + num+ "]";}}package com.shoeShop.entity;/***功能:买家实体类* @author:*2012-9-19下午4:16:46*/public class Seller {private String id;private String name;private String pwd;private String address;public String getPwd() {return pwd;}public void setPwd(String pwd) {this.pwd = pwd;}public String getId() {return id;}public void setId(String id) {this.id = id;}public String getName() {return name;}public void setName(String name) { = name;}public String getAddress() {return address;}public void setAddress(String address) {this.address = address;}@Overridepublic String toString() {return "Seller [id=" + id + ", name=" + name + ", pwd=" + pwd+ ", address=" + address + "]";}}package com.shoeShop.imp;public class User {private static int flag = 0;private static String userName;private static String pwd;public static String getPwd() {return pwd;}public static void setPwd(String pwd) {User.pwd = pwd;}public static String getUserName() {return userName;}public static void setUserName(String userName) { erName = userName;}public static int getFlag() {return flag;}public static void setFlag(int flag) {User.flag = flag;}}package com.shoeShop.view;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JTextField;import com.shoeShop.dao.GoodsDao;import com.shoeShop.entity.Goods;public class AddGoodsFrame extends JFrame{private static final Goods Goods = null;private JLabel lbName = new JLabel("商品名:");private JLabel lbPrice = new JLabel("价格:");private JLabel lbDiscount = new JLabel("折扣:");private JLabel lbNum = new JLabel("数量:");private JTextField fieldName = new JTextField(20);private JTextField fieldPrice = new JTextField(20);private JTextField fieldDiscount = new JTextField(20);private JTextField fieldNum = new JTextField(20);private JButton btSure = new JButton("确定");private JButton btCancel = new JButton("取消");private Goods goods = new Goods();public AddGoodsFrame(){init();}private void init(){this.setSize(320, 330);this.setTitle("商品添加");this.setIconImage(new ImageIcon("images/1.png").getImage());this.setLayout(null);this.setLocationRelativeTo(null);this.setResizable(false);// this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);this.setLayout(null);setContentPanel();}private void setContentPanel(){lbName.setBounds(30, 30, 80, 30);fieldName.setBounds(130, 30, 150, 30);lbPrice.setBounds(30, 90, 80, 30);fieldPrice.setBounds(130, 90, 150, 30);lbDiscount.setBounds(30, 150, 80, 30);fieldDiscount.setBounds(130, 150, 150, 30);lbNum.setBounds(30, 200, 80, 30);fieldNum.setBounds(130, 200, 150, 30);btCancel.setBounds(30, 250, 70, 30);btSure.setBounds(210, 250, 70, 30);this.add(lbName);this.add(fieldName);this.add(lbPrice);this.add(fieldPrice);this.add(lbDiscount);this.add(fieldDiscount);this.add(lbNum);this.add(fieldNum);this.add(btCancel);this.add(btSure);btCancel.addActionListener(new ActionListener() {@Overridepublic void actionPerformed(ActionEvent e) {// TODO Auto-generated method stubsetVisible(false);}});btSure.addActionListener(new ActionListener() {@Overridepublic void actionPerformed(ActionEvent e) {// TODO Auto-generated method stubif(JOptionPane.showConfirmDialog(null, "您确定要添加吗?")==0){ GoodsDao dao = new GoodsDao();goods.setDiscount(Integer.valueOf(fieldDiscount.getText()));goods.setName(fieldName.getText());goods.setNum(Integer.valueOf(fieldNum.getText()));goods.setPrice(Integer.valueOf(fieldPrice.getText()));dao.insertGoods(goods);setVisible(false);JOptionPane.showMessageDialog(null, "添加成功!");}else{//}}});}public Goods getGoods() {return goods;}public void setGoods(Goods goods) {this.goods = goods;}public static void main(String[] args) {UpdateFrame frame = new UpdateFrame();frame.setVisible(true);}}package com.shoeShop.view;import java.awt.BorderLayout;import java.awt.Color;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.util.ArrayList;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JComboBox;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JMenu;import javax.swing.JMenuBar;import javax.swing.JMenuItem;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JTable;import javax.swing.JTextField;import com.shoeShop.dao.GoodsDao;import com.shoeShop.dao.OrderDao;import com.shoeShop.entity.Goods;import com.shoeShop.entity.Order;public class BuyerFrame extends JFrame{private JPanel goodsPanel = new JPanel();//中间面板private JPanel orderPanel = new JPanel();//订单面板private JPanel southPanel = new JPanel();//南边用于方按钮的面板private JMenuBar menuBar = new JMenuBar();private JMenu goodsMenu = new JMenu("商品管理");private JMenu orderMenu = new JMenu("订单管理");private JMenuItem goodsMenuItem = new JMenuItem("商品购置");private JMenuItem orderMenuItem = new JMenuItem("订单管理");// private JButton btDelet = new JButton("删除");private JButton btAdd = new JButton("购置");private JComboBox numBox = new JComboBox(new String[]{"1","2","3","4","5","6","7","8","9"});// private JButton btUpdate = new JButton("修改");private JTextField fieldId = new JTextField(15);Object ar[][] =new Object[80][8];Object or[][] =new Object[80][9];public BuyerFrame(){init();}private void init(){setMenuBar();this.setTitle("网上鞋购系统");this.setIconImage(new ImageIcon("images/1.png").getImage());this.setSize(600, 400);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);this.setLocationRelativeTo(null);this.add(menuBar,BorderLayout.NORTH);setGoodsPanel();goodsPanel.setBackground(Color.GRAY);this.add(goodsPanel,BorderLayout.CENTER);orderPanel.setBackground(Color.LIGHT_GRAY);setSouthPanel();setOrderPanel();this.add(southPanel,BorderLayout.SOUTH);}//borderlayout 北边面板设置private void setMenuBar(){menuBar.add(goodsMenu);goodsMenu.add(goodsMenuItem);goodsMenuItem.addActionListener(new ActionListener() { @Overridepublic void actionPerformed(ActionEvent e) {// TODO Auto-generated method stubsetAr();remove(orderPanel);add(goodsPanel);goodsPanel.updateUI();}});menuBar.add(orderMenu);orderMenu.add(orderMenuItem);orderMenuItem.addActionListener(new ActionListener() { @Overridepublic void actionPerformed(ActionEvent e) {// TODO Auto-generated method stubsetOr();。
ASP网上书店的设计与实现
ASP网上书店的设计与实现
黄武锋
【期刊名称】《电脑编程技巧与维护》
【年(卷),期】2008(000)013
【摘要】利用ASP和ADO技术开发网上书店,是Internet电子商务在图书销售行业发展的必然结果.本文主要针对小型书店开拓其网上业务而开发的图书销售系统.该系统实现了图书信息的显示、添加、删除及查询,客户提交定单、意见留言以及管理员处理网上定单业务的功能.
【总页数】3页(P59-61)
【作者】黄武锋
【作者单位】广西财经学院计算机与信息管理系,南宁,530003
【正文语种】中文
【中图分类】TP3
【相关文献】
1.基于网上书店的设计与实现 [J], 李梁奇;莫雯朗
2.基于ASP的网上书店系统的设计与实现 [J], 周蔓兰;辜萍萍
3.基于的网上书店设计与实现 [J], 李志云
4.基于的网上书店设计与实现 [J], 宋卫华
5.基于ACCESS+ASP技术的网上书店的设计与实现 [J], 谭晶晶;朱世杰
因版权原因,仅展示原文概要,查看原文内容请购买。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
package user;import java.sql.*;import java.util.*;import java.util.Date;import java.sql.PreparedStatement;import com.ConnDB;import java.sql.*;import java.util.*;import com.ConnDB;public class UserDB extends ConnDB{private ArrayList user;public UserDB () throws Exception{}public boolean userExist(String username){boolean occupied=true;try{ConnDB.initialize(); // create database connection PreparedStatement preparedStatement = conn.prepareStatement ( "select userid from Buser where username=?"); preparedStatement.setString (1, username);ResultSet resultSet = preparedStatement.executeQuery ();if(!resultSet.next())occupied=false;preparedStatement.close ();ConnDB.terminate();}catch(SQLException e){e.printStackTrace();}return occupied;}public boolean isValidUser (String username, String password){boolean isValid=false;try{ConnDB.initialize(); // create database connectionPreparedStatement preparedStatement = conn.prepareStatement ("SELECT username, password FROM Buser WHERE username=? and password=?"); preparedStatement.setString (1, username);preparedStatement.setString (2, password);ResultSet resultSet = preparedStatement.executeQuery ();if (resultSet.next ()){isValid=true;preparedStatement.close ();ConnDB.terminate();}else{preparedStatement.close ();ConnDB.terminate();//return isValid;}}catch (SQLException e){//return isValid;}return isValid;}public boolean find(String key){boolean gotIt=false;try{ConnDB.initialize(); // create database connection PreparedStatement preparedStatement = conn.prepareStatement ( "SELECT username, password FROM Buser WHERE username = ?"); preparedStatement.setString (1, key);ResultSet resultSet = preparedStatement.executeQuery ();if (resultSet.next ()){gotIt=true;preparedStatement.close ();ConnDB.terminate();}else{preparedStatement.close ();ConnDB.terminate();//return isValid;}}catch (SQLException e){//return gotIt;}return gotIt;}public User getUser (int id){try{ConnDB.initialize(); // create database connectionPreparedStatement preparedStatement = conn.prepareStatement ("SELECT userid, username, rname, password, email, address, postdate, tel " +"FROM Buser WHERE userId = ?");preparedStatement.setInt (1, id);ResultSet resultSet = preparedStatement.executeQuery ();if (resultSet.next ()){User users = new User(resultSet.getInt (1), resultSet.getString (2), resultSet.getString (3), resultSet.getString (4),resultSet.getString (5), resultSet.getString (6), resultSet.getString (7), resultSet.getString (8));preparedStatement.close ();ConnDB.terminate();return users;}else{preparedStatement.close ();return null;}}catch (SQLException e){ConnDB.terminate();return null;}}public User getUser (String username){try{ConnDB.initialize(); // create database connectionPreparedStatement preparedStatement = conn.prepareStatement ("SELECT userid, username, rname, password, email, address, postdate, tel " +"FROM Buser WHERE username = ?");preparedStatement.setString (1, username);ResultSet resultSet = preparedStatement.executeQuery ();if (resultSet.next ()){User users = new User(resultSet.getInt (1), resultSet.getString (2), resultSet.getString (3), resultSet.getString (4),resultSet.getString (5), resultSet.getString (6), resultSet.getString (7), resultSet.getString (8));preparedStatement.close ();ConnDB.terminate();return users;}else{preparedStatement.close ();ConnDB.terminate();return null;}}catch (SQLException e){ConnDB.terminate();return null;}}public int addUsers (User users){System.out.println("**");int rowsAffected = 0;try{ConnDB.initialize(); // create database connectionPreparedStatement preparedStatement = conn.prepareStatement ("INSERT INTO Buser (username, rname, password, email, address, postdate, tel) " + "VALUES (?, ?, ?, ?, ?, ?, ?)");preparedStatement.setString (1, users.getUsername ());preparedStatement.setString (2, users.getRname ());preparedStatement.setString (3, users.getPassword());preparedStatement.setString (4, users.getEmail());preparedStatement.setString (5, users.getAddress());preparedStatement.setString (6, users.getPostdate());preparedStatement.setString (7, users.getT el());//判断是否重复添加if(find(users.getUsername ())){rowsAffected =2;System.out.println("exist username");}else{rowsAffected = preparedStatement.executeUpdate ();System.out.println(rowsAffected + "add");}preparedStatement.close ();ConnDB.terminate();}catch (SQLException e){ConnDB.terminate();return 0;}return rowsAffected;}public int deleteUser (int id){int rowsAffected = 0;try{ConnDB.initialize(); // create database connectionPreparedStatement preparedStatement = conn.prepareStatement ("DELETE FROM Buser WHERE userid = ?");preparedStatement.setInt (1, id);rowsAffected = preparedStatement.executeUpdate ();preparedStatement.close ();ConnDB.terminate();}catch (SQLException e){ConnDB.terminate();return 0;}return rowsAffected;}public int modifyUser (User users){int rowsAffected = 0;try{ConnDB.initialize(); // create database connectionPreparedStatement preparedStatement = conn.prepareStatement ("UPDATE Buser SET username=?, rname=?, password=?, email=?, address=?, postdate=?, tel=? " +"WHERE userid =?");preparedStatement.setString (1, users.getUsername ());preparedStatement.setString (2, users.getRname ());preparedStatement.setString (3, users.getPassword());preparedStatement.setString (4, users.getEmail());preparedStatement.setString (5, users.getAddress());preparedStatement.setString (6, users.getPostdate());preparedStatement.setString (7, users.getT el());preparedStatement.setInt (8, users.getId ());rowsAffected = preparedStatement.executeUpdate ();ConnDB.terminate();}catch (SQLException e){ConnDB.terminate();return 0;}return rowsAffected;}public Collection getUser (){user = new ArrayList ();try{ConnDB.initialize(); // create database connectionPreparedStatement preparedStatement = conn.prepareStatement ("SELECT userid, username, rname, password, email, address, postdate, tel " +"FROM Buser");ResultSet resultSet = preparedStatement.executeQuery ();while (resultSet.next ()){User users = new User(resultSet.getInt (1), resultSet.getString (2), resultSet.getString (3), resultSet.getString (4),resultSet.getString (5), resultSet.getString (6), resultSet.getString (7), resultSet.getString (8));user.add(users);}}catch (SQLException e){return null;}ConnDB.terminate();//Collections.sort(user);return user;}public boolean isModify(String key,int id){boolean modifyIt=false;try{ConnDB.initialize(); // create database connection PreparedStatement preparedStatement = conn.prepareStatement ( "SELECT userid FROM Buser WHERE username = ? and userd <> ?"); preparedStatement.setString (1, key);preparedStatement.setInt (2, id);ResultSet resultSet = preparedStatement.executeQuery ();if (resultSet.next ()){modifyIt=true;preparedStatement.close ();ConnDB.terminate();}else{preparedStatement.close ();ConnDB.terminate();//return isValid;}}catch (SQLException e) {ConnDB.terminate();//return gotIt;}return modifyIt;}}。