用java做的一個(gè)圖書管理系統(tǒng)的源代碼_第1頁
用java做的一個(gè)圖書管理系統(tǒng)的源代碼_第2頁
用java做的一個(gè)圖書管理系統(tǒng)的源代碼_第3頁
用java做的一個(gè)圖書管理系統(tǒng)的源代碼_第4頁
用java做的一個(gè)圖書管理系統(tǒng)的源代碼_第5頁
已閱讀5頁,還剩37頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、精選優(yōu)質(zhì)文檔-傾情為你奉上精選優(yōu)質(zhì)文檔-傾情為你奉上專心-專注-專業(yè)專心-專注-專業(yè)精選優(yōu)質(zhì)文檔-傾情為你奉上專心-專注-專業(yè)用java做的一個(gè)圖書管理系統(tǒng)的源代碼import java.sql.*;import java.util.*;public class Tpublic static void main(String args) throws ExceptionConnection conn=null;Statement stmt=null;ResultSet rs=null;while(true)Scanner scanner=new Scanner(System.in);Syste

2、m.out.println(請(qǐng)輸入用戶名:);String username2=scanner.next();System.out.println(請(qǐng)輸入密碼:);String password2=scanner.next();if(!(username2.equals()|password2.equals()tryClass.forName(sun.jdbc.odbc.JdbcOdbcDriver);conn=DriverManager.getConnection(jdbc:odbc:book,);String sql=select * from ww where username=+use

3、rname2+;stmt=conn.createStatement();rs=stmt.executeQuery(sql);if(rs.next()if(rs.getString(password).equals(password2)System.out.println(*歡迎來山東科技大學(xué)圖書館管理系統(tǒng)*);while(true)System.out.println(1.圖書信息);System.out.println(2.讀者信息);System.out.println(3.管理員信息);System.out.println(4.借閱信息);System.out.println(5.還書信

4、息);System.out.println(6.逾期罰款或損壞賠償信息);/System.out.println(7.退出);System.out.println(請(qǐng)輸入選擇功能的序號(hào):);int a=scanner.nextInt();switch(a)case 1:System.out.println(圖書信息:);System.out.println(1.查詢圖書信息:);System.out.println(2.插入圖書信息:);System.out.println(3.刪除圖書信息:);System.out.println(4.修改圖書信息:);int a1=scanner.next

5、Int();switch(a1)case 1:System.out.println(歡迎進(jìn)入圖書信息查詢系統(tǒng):);System.out.println(1.無條件查詢圖書信息:);System.out.println(2.條件查詢圖書信息:);int d=scanner.nextInt();switch(d)case 1:int llll=0;/int mm=0;while(llll!=1)System.out.println(1.無條件查詢圖書信息:);String Sql0 = SELECT * FROM systembook ;rs= stmt.executeQuery(Sql0);wh

6、ile(rs.next()StringbookID =rs.getString(1);StringbookNo =rs.getString(2);String bookName =rs.getString(3);String bookWriter =rs.getString(4);String bookPub =rs.getString(5);System.out.println(bookID+,+bookNo+,+bookName+,+bookWriter+,+bookPub);System.out.println(是否繼續(xù)插入?yes/no no返回主菜單);String k=scanne

7、r.next();if(k.startsWith(yes)System.out.println();if(k.startsWith(no)=+A+ ;llll=1;System.out.println();break;/break;case 2:System.out.println(2.條件查詢圖書信息:);System.out.println(1.單條件查詢圖書信息:);System.out.println(2.模糊條件查詢圖書信息:);System.out.println(3.多表連接查詢圖書信息:);System.out.println(4.嵌套查詢圖書信息:);System.out.p

8、rintln(5.謂詞演算查詢);int c12=scanner.nextInt();switch(c12)case 1:System.out.println(1.單條件查詢:);System.out.println(1.按圖書名編碼號(hào)查詢圖書信息:);int ddd=0;while(ddd!=1)System.out.println(請(qǐng)輸入圖書編碼號(hào):);String A=scanner.next();Stringsql1=SELECT*FROMsystembookWHEREbookIDrs= stmt.executeQuery(sql1);int x=0;while(rs.next()St

9、ringa2 =rs.getString(1);Stringb2 =rs.getString(2);Stringc2 =rs.getString(3);Stringd2 =rs.getString(4);Stringe2 =rs.getString(5);System.out.println(a2+,+b2+ ,+c2+,+d2+,+e2);x+;if(x=0)System.out.println(查無此書,請(qǐng)重新輸入);回主菜單);LIKE+E+%;elseSystem.out.println(是否繼續(xù)按姓名查詢?yes/nono返String k=scanner.next();if(k.s

10、tartsWith(yes)System.out.println();if(k.startsWith(no)ddd=1;System.out.println();break;case 2:System.out.println(2.模糊查詢圖書信息:);int dc=0;while(dc!=1)System.out.println(請(qǐng)用戶輸入圖書名字中的模糊關(guān)鍵字);String E=scanner.next();String sq123= SELECT * FROM systembook WHERE bookNamers= stmt.executeQuery(sq123);int z=0;wh

11、ile(rs.next()Stringa2 =rs.getString(1);Stringb2 =rs.getString(2);Stringc2 =rs.getString(3);Stringd2 =rs.getString(4);Stringe2 =rs.getString(5);System.out.println(a2+,+b2+ ,+c2+,+d2+,+e2);z+;if(z=0)System.out.println(查無此書,請(qǐng)重新輸入);elseSystem.out.println(是否繼續(xù)輸入圖書名字中的模糊關(guān)鍵字?yes/no no返回主菜單);String k=scanne

12、r.next();if(k.startsWith(yes)System.out.println();if(k.startsWith(no)dc=1;System.out.println();/ break;break;case 3:System.out.println(3.多表連接查詢查詢圖書信息:);int dq=0;while(dq!=1)System.out.println(查詢逾期罰款或是賠償表中的讀者的相關(guān)信息);System.out.println(請(qǐng)輸入逾期罰款或是賠償?shù)淖x者編碼號(hào));String F=scanner.next();String sq1234= SELECT *

13、FROM fine,borrowbook,systemreaderWHEREfine.bookID=borrowbook.bookIDANDborrowbook.reaID=systemreader.reaIDANDfine.bookID=+F+ ;rs= stmt.executeQuery(sq1234);int n=0;while(rs.next()Stringa2 =rs.getString(1);Stringb2 =rs.getString(2);Stringc2 =rs.getString(3);Stringd2 =rs.getString(4);Stringe2 =rs.getSt

14、ring(5);System.out.println(a2+,+b2+ ,+c2+,+d2+,+e2);n+;if(n=0)System.out.println(查無此人,請(qǐng)重新輸入);elseSystem.out.println(是否繼續(xù)輸入圖書名字中的模糊關(guān)鍵字?yes/no no返回主菜單);String k=scanner.next();if(k.startsWith(yes)System.out.println();if(k.startsWith(no)ddd=1;System.out.println();break;case 4:System.out.println(4.嵌套查詢圖

15、書信息:);int dq1=0;while(dq1!=1)System.out.println(查詢某讀者所在年級(jí)女讀者的相關(guān)信息);System.out.println(請(qǐng)輸入某讀者的讀者編號(hào));String G=scanner.next();Stringsq12345=SELECT*FROMsystemreaderWHEREreaGrade=(SELECT reaGrade FROM systemreader WHERE reaID=+G+) AND reasex=女;rs= stmt.executeQuery(sq12345);int m=0;while(rs.next()返回主菜單);

16、Stringa2 =rs.getString(1);Stringb2 =rs.getString(2);Stringc2 =rs.getString(3);Stringd2 =rs.getString(4);Stringe2 =rs.getString(5);System.out.println(a2+,+b2+ ,+c2+,+d2+,+e2);m+;if(m=0)System.out.println(查無此書,請(qǐng)重新輸入);elseSystem.out.println(是否繼續(xù)輸入讀者編號(hào)?yes/nonoString k=scanner.next();if(k.startsWith(yes

17、)System.out.println();if(k.startsWith(no)d=1;System.out.println();break;case 5:System.out.println(5.謂詞演算查詢:);int dq1123=0;while(dq1123!=1)System.out.println(查詢借閱了某本書的讀者的相關(guān)信息);System.out.println(請(qǐng)輸入該書的名字);String H=scanner.next();Stringsq=SELECT*FROMsystemreaderWHEREreaID IN (SELECT reaID FROM borrowb

18、ook WHERE bookName=+H+);rs= stmt.executeQuery(sq);int l=0;while(rs.next()Stringa2 =rs.getString(1);Stringb2 =rs.getString(2);Stringc2 =rs.getString(3);Stringd2 =rs.getString(4);Stringe2 =rs.getString(5);System.out.println(a2+,+b2+ ,+c2+,+d2+,+e2);l+;if(l=0)System.out.println(查無此人,請(qǐng)重新輸入);elseSystem.o

19、ut.println(是否繼續(xù)輸入圖書名字?yes/no no返回主菜單);String k=scanner.next();if(k.startsWith(yes)System.out.println();if(k.startsWith(no)d=1;System.out.println();break;/c12break;break;/*case 1:System.out.println(1.查詢圖書信息:);String Sql = SELECT * FROM systembook;rs= stmt.executeQuery(Sql);while(rs.next()/String str

20、=scanner.next();StringbookID =rs.getString(1);StringbookNo =rs.getString(2);String bookName =rs.getString(3);String bookWriter =rs.getString(4);String bookPub =rs.getString(5);System.out.println(bookID+,+bookNo+,+bookName+,+bookWriter+,+bookPub);break;*/case 2:int zz=0;while(zz!=1)System.out.println

21、(2.插入圖書信息:);System.out.println(請(qǐng)按順序插入圖書條碼號(hào),圖書索書號(hào),圖書名字,圖書作者,圖書出版社);String str=scanner.next();String splitst=str.split(,);String a11=splitst0;String a12=splitst1;String a13=splitst2;String a14=splitst3;String a15=splitst4;StringinsertSql=INSERTsystembook(bookID,bookNo,bookName,bookWriter,bookPub)VALUE

22、S(+a11+,+a12+,+a13+,+a14+,+a15+);int i=stmt.executeUpdate(insertSql); /返回記錄影響的條數(shù)if(i!=0)System.out.println(插入成功!);System.out.println(是否繼續(xù)插入?yes/no no返回主菜單);String k=scanner.next();if(k.startsWith(yes)System.out.println();if(k.startsWith(no)zz=1;System.out.println();break;case 3:int ll=0;/int mm=0;wh

23、ile(ll!=1)INTOSystem.out.println(3.刪除圖書信息:);System.out.println(請(qǐng)輸入要?jiǎng)h除的圖書編號(hào):);String Str=scanner.next();String Splitst=Str.split(,);String b3=Splitst0;String sql1=SELECT * FROM systembook where bookID=+b3+;rs= stmt.executeQuery(sql1);int kkk=0;while(rs.next()Stringa22 =rs.getString(1);Stringb22 =rs.g

24、etString(2);Stringc22 =rs.getString(3);Stringd22 =rs.getString(4);Stringe22 =rs.getString(5);Stringf22 =rs.getString(6);System.out.println(a22+,+b22+ ,+c22+,+d22+,+e22+,+f22);kkk+;if(kkk=0)System.out.println(沒有這本書,請(qǐng)重新輸入);elseStringdeleSql=DELETEFROMsystembookWHEREbookID=+b3+;int p=stmt.executeUpdate

25、(deleSql); /返回記錄影響的條數(shù)if(p!=0)System.out.println(刪除成功!);System.out.println(是否繼續(xù)刪除?yes/no no返回主菜單);String l=scanner.next();if(l.startsWith(yes)System.out.println();if(l.startsWith(no)ll=1;System.out.println();break;case 4:int mm=0;while(mm!=1)System.out.println(4.修改圖書信息:);System.out.println(請(qǐng)輸入修改的圖書ID

26、);String S=scanner.next();String sql1=SELECT * FROM systembook where bookID=+S+;rs= stmt.executeQuery(sql1);int lll=0;while(rs.next()Stringa222 =rs.getString(1);Stringb222 =rs.getString(2);Stringc222 =rs.getString(3);Stringd222 =rs.getString(4);Stringe222 =rs.getString(5);Stringf222 =rs.getString(6)

27、;System.out.println(a222+,+b222+ ,+c222+,+d222+,+e222+,+f222);lll+;if(lll=0)System.out.println(沒有這本書,請(qǐng)重新輸入);elseSystem.out.println(要將書名改為);String bbb=scanner.next();String updateSql1=UPDATE systembookSET bookName=+bbb+WHERE bookID=+S+;int hh=stmt.executeUpdate(updateSql1); /返回記錄影響的條數(shù)if(hh!=0)System.

28、out.println(修改成功!);System.out.println(是否繼續(xù)修改yes/no no返回主菜單);String o=scanner.next();if(o.startsWith(yes)System.out.println();if(o.startsWith(no)mm=1;System.out.println();break;break;/*StringupdateSql=UPDATEsystembookSETbookCopy=+c1+WHERE bookName=數(shù)據(jù)庫管理;int t=stmt.executeUpdate(updateSql); /返回記錄影響的條數(shù)

29、if(t!=0)System.out.println(修改成功!);break;break;*/case 2:System.out.println(讀者信息:);System.out.println(1.查詢讀者信息:);System.out.println(2.插入讀者信息:);System.out.println(3.刪除讀者信息:);System.out.println(4.修改讀者信息:);int b1=scanner.nextInt();switch(b1)case 1:System.out.println(1.查詢讀者信息:);String ssql = SELECT * FROM

30、 systemreader ;rs= stmt.executeQuery(ssql);while(rs.next()/ String str =scanner.next();StringreaID=rs.getString(1);StringreaName =rs.getString(2);StringreaLBID =rs.getString(3);StringreaNo =rs.getString(4);StringreaSex =rs.getString(5);StringreaType =rs.getString(6);StringreaDep =rs.getString(7);Str

31、ingreaGrade =rs.getString(8);StringreaPre =rs.getString(9);StringreaDate =rs.getString(10);System.out.println(reaID+,+reaName+,+reaNo+,+reaSex+,+reaLBID+,+reaType+,+reaDep+,+reaGrade+,+reaPre+,+reaDate);break;case 2:int zz=0;while(zz!=1)System.out.println(2.插入讀者信息:);System.out.println(請(qǐng)按順序插入借書卡證號(hào)讀者名

32、字讀者學(xué)號(hào)讀者性別讀者LBID讀者類型讀者學(xué)院讀者年級(jí)讀者專業(yè)辦證日期);String str=scanner.next();String splitst=str.split(,);String b11=splitst0;String b12=splitst1;String b13=splitst2;String b14=splitst3;String b15=splitst4;String b16=splitst5;String b17=splitst6;String b18=splitst7;String b19=splitst8;String b20=splitst9;Stringins

33、ertSql=INSERTINTOsystemreader(reaID,reaName,reaNo,reaSex,reaLBID,reaType,reaDep,reaGrade,reaPre,reaDate)VALUES(+b11+,+b12+,+b13+,+b14+,+b15+,+b16+,+b17+,+b18+,+b19+,+b20+);int n=stmt.executeUpdate(insertSql); /返回記錄影響的條數(shù)if(n!=0)System.out.println(插入成功!);System.out.println(是否繼續(xù)插入?yes/no no返回主菜單);Strin

34、g k=scanner.next();if(k.startsWith(yes)System.out.println();if(k.startsWith(no)zz=1;System.out.println();break;case 3:int ll=0;while(ll!=1)System.out.println(3.刪除讀者信息:);System.out.println(請(qǐng)輸入要?jiǎng)h除的讀者證號(hào):);String Str=scanner.next();String Splitst=Str.split(,);String r=Splitst0;String sql1=SELECT * FROM

35、systemreader where reaID=+r+;rs= stmt.executeQuery(sql1);int kkk=0;while(rs.next()Stringa22 =rs.getString(1);Stringb22 =rs.getString(2);Stringc22 =rs.getString(3);Stringd22 =rs.getString(4);Stringe22 =rs.getString(5);Stringf22 =rs.getString(6);Stringg22 =rs.getString(7);Stringh22 =rs.getString(8);St

36、ringi22 =rs.getString(9);System.out.println(a22+,+b22+ ,+c22+,+d22+,+e22+,+f22+,+g22+,+h22+,+i22);kkk+;if(kkk=0)System.out.println(沒有這個(gè)讀者,請(qǐng)重新輸入);else/System.out.println(您是否真的要?jiǎng)h除? yes/no);/String k=scanner.next();/if(k.startsWith(y)StringdeleSql=DELETEFROMsystemreaderWHEREreaID=+r+;int p=stmt.execute

37、Update(deleSql); /返回記錄影響的條數(shù)if(p!=0)System.out.println(刪除成功!);System.out.println(是否繼續(xù)刪除?yes/no no返回主菜單);String l=scanner.next();if(l.startsWith(yes)System.out.println();if(l.startsWith(no)ll=1;System.out.println();reaID=+r+;/*StringdeleSql=DELETEFROMsystemreaderWHEREint m=stmt.executeUpdate(deleSql);

38、 /返回記錄影響的條數(shù)if(m!=0)System.out.println(刪除成功!);*/break;case 4:int mm=0;while(mm!=1)System.out.println(4.修改讀者信息:);System.out.println(請(qǐng)輸入修改以后的讀者的ID );String S=scanner.next();/ String Ssplitst=S.split(,);/String tt=Ssplitst0;String sql1=SELECT * FROM systemreader where reaID=+S+;rs= stmt.executeQuery(sql

39、1);int lll=0;while(rs.next()Stringa222 =rs.getString(1);Stringb222 =rs.getString(2);Stringc222 =rs.getString(3);Stringd222 =rs.getString(4);Stringe222 =rs.getString(5);Stringf222 =rs.getString(6);Stringg222 =rs.getString(7);Stringh222 =rs.getString(8);Stringi222 =rs.getString(9);Stringj222 =rs.getSt

40、ring(10);System.out.println(a222+,+b222+,+c222+,+d222+,+e222+,+f222+,+g222+,+h222+,+i222+,+j222);lll+;if(lll=0)System.out.println(沒有這個(gè)人,請(qǐng)重新輸入);elseSystem.out.println(要將名字改為);String bb=scanner.next();StringupdateSql=UPDATEsystemreaderSETreaName=+bb+WHERE reaID=+S+;int hh=stmt.executeUpdate(updateSql)

41、; /返回記錄影響的條數(shù)if(hh!=0)System.out.println(修改成功!);System.out.println(是否繼續(xù)修改yes/no no返回主菜單);String o=scanner.next();if(o.startsWith(yes)System.out.println();if(o.startsWith(no)mm=1;System.out.println();break;/*StringupdateSql=UPDATEsystemreaderSETreaSex=+tt+WHEREreaID=;int l=stmt.executeUpdate(updateSql

42、); /返回記錄影響的條數(shù)if(l!=0)System.out.println(修改成功!);break;*/break;case 3:System.out.println(管理員信息:);System.out.println(1.查詢管理員信息:);System.out.println(2.插入管理員信息:);System.out.println(3.刪除管理員信息:);System.out.println(4.修改管理員信息:);System.out.println(5.返回上一級(jí));int c11=scanner.nextInt();switch(c11)case 1:System.ou

43、t.println(1.查詢管理員信息:);String Ssql = SELECT * FROM manager ;rs= stmt.executeQuery(Ssql);while(rs.next()/ String str =scanner.next();String mID =rs.getString(1);String mName=rs.getString(2);String mSex =rs.getString(3);System.out.println(mID+,+mName+,+mSex);break;case 2:int zz=0;while(zz!=1)System.out

44、.println(2.插入管理員信息:);System.out.println(請(qǐng)按順序插入管理員的編號(hào),管理員的姓名,管理員的性別,所管書庫,電話,地址);String str=scanner.next();String splitst=str.split(,);String a11=splitst0;String a12=splitst1;String a13=splitst2;String a14=splitst3;String a15=splitst4;String a16=splitst5;StringinsertSql=INSERTmanager(mID,mName,mSex,mA

45、uth,mTeleph,mAddre)VALUES(+a11+,+a12+,+a13+,+a14+,+a15+,+a16+);int i=stmt.executeUpdate(insertSql); /返回記錄影響的條數(shù)if(i!=0)System.out.println(插入成功!);System.out.println(是否繼續(xù)插入?yes/no no返回主菜單);String k=scanner.next();if(k.startsWith(yes)System.out.println();if(k.startsWith(no)zz=1;System.out.println();brea

46、k;case 3:INTOint ll=0;while(ll!=1)System.out.println(3.刪除管理員信息:);System.out.println(請(qǐng)輸入要?jiǎng)h除的管理員編號(hào):);String Str=scanner.next();String Splitst=Str.split(,);String b3=Splitst0;String sql1=SELECT * FROM manager where mID=+b3+;rs= stmt.executeQuery(sql1);int kkk=0;while(rs.next()Stringa22 =rs.getString(1)

47、;Stringb22 =rs.getString(2);Stringc22 =rs.getString(3);Stringd22 =rs.getString(4);Stringe22 =rs.getString(5);Stringf22 =rs.getString(6);System.out.println(a22+,+b22+ ,+c22+,+d22+,+e22+,+f22);kkk+;if(kkk=0)System.out.println(沒有這個(gè)管理員,請(qǐng)重新輸入);else/System.out.println(您是否真的要?jiǎng)h除? yes/no);/String k=scanner.n

48、ext();/if(k.startsWith(y)StringdeleSql=DELETEFROMmanagerWHEREmID=+b3+;int p=stmt.executeUpdate(deleSql); /返回記錄影響的條數(shù)if(p!=0)System.out.println(刪除成功!);System.out.println(是否繼續(xù)刪除?yes/no no返回主菜單);String l=scanner.next();if(l.startsWith(yes)System.out.println();if(l.startsWith(no)ll=1;System.out.println()

49、;/* String deleSql= DELETE mIDFROM manager WHERE mID=+b3+;int k=stmt.executeUpdate(deleSql); /返回記錄影響的條數(shù)if(k!=0)System.out.println(刪除成功!);*/break;case 4:int mm=0;while(mm!=1)System.out.println(4.修改管理員信息:);System.out.println(請(qǐng)輸入要修改的管理員編號(hào):);String S=scanner.next();String Ssplitst=S.split(,);String c1=S

50、splitst0;String sql1=SELECT * FROM manager where mID=+S+;rs= stmt.executeQuery(sql1);int lll=0;while(rs.next()Stringa222 =rs.getString(1);Stringb222 =rs.getString(2);Stringc222 =rs.getString(3);Stringd222 =rs.getString(4);Stringe222 =rs.getString(5);Stringf222 =rs.getString(6);System.out.println(a22

51、2+,+b222+ ,+c222+,+d222+,+e222+,+f222);lll+;if(lll=0)mID=+S+;System.out.println(沒有這個(gè)管理員,請(qǐng)重新輸入);else/ System.out.println(要修改的信息);/String aa=scanner.next();System.out.println(要將它改為);String bb=scanner.next();StringupdateSql=UPDATEmanagerSETmName=+bb+WHEREint hh=stmt.executeUpdate(updateSql); /返回記錄影響的條數(shù)

52、if(hh!=0)System.out.println(修改成功!);System.out.println(是否繼續(xù)修改yes/no no返回主菜單);String o=scanner.next();if(o.startsWith(yes)System.out.println();if(o.startsWith(no)mm=1;System.out.println();break;break;/*String updateSql=UPDATE manager SET mSex=+c1+ WHERE mID=1;int t=stmt.executeUpdate(updateSql); /返回記錄

53、影響的條數(shù)if(t!=0)System.out.println(修改成功!);break;*/case 4:System.out.println(圖書借閱信息:);System.out.println(1.查詢圖書借閱信息信息:);System.out.println(2.插入圖書借閱信息:);System.out.println(3.刪除圖書借閱信息:);System.out.println(4.修改圖書借閱信息:);System.out.println(5.返回上一級(jí));int d=scanner.nextInt();switch(d)case 1:System.out.println(1

54、.查詢圖書借閱信息:);String Sql4 = SELECT * FROM borrowbook ;rs= stmt.executeQuery(Sql4);while(rs.next()String bookID =rs.getString(1);String reaID =rs.getString(2);String outDate =rs.getString(3);String yhDate =rs.getString(4);System.out.println(bookID+,+reaID+,+outDate+,+yhDate);break;case 2:int zz=0;while

55、(zz!=1)System.out.println(2.插入圖書借閱信息:);System.out.println(請(qǐng)按順序插入圖書的的編號(hào),讀者編號(hào),圖書借出日期,圖書歸還日期);String str=scanner.next();String splitst=str.split(,);String a11=splitst0;String a12=splitst1;String a13=splitst2;String a14=splitst3;/String a15=splitst4;/String a16=splitst5;StringinsertSql=INSERTINTOborrowb

56、ook(bookID,reaID,outDate,yhDate)VALUES(+a11+,+a12+,+a13+,+a14+);int ii=stmt.executeUpdate(insertSql); /返回記錄影響的條數(shù)if(ii!=0)System.out.println(插入成功!);System.out.println(是否繼續(xù)插入?yes/no no返回主菜單);String k=scanner.next();if(k.startsWith(yes)System.out.println();if(k.startsWith(no)zz=1;System.out.println();b

57、reak;case 3:int ll=0;while(ll!=1)System.out.println(3.刪除圖書借閱信息:);System.out.println(請(qǐng)輸入要?jiǎng)h除的圖書條碼號(hào):);String Str=scanner.next();String Splitst=Str.split(,);String b3=Splitst0;String sql1=SELECT * FROM borrowbook where bookID=+b3+;rs= stmt.executeQuery(sql1);int kkk=0;while(rs.next()Stringa22 =rs.getStr

58、ing(1);Stringb22 =rs.getString(2);Stringc22 =rs.getString(3);Stringd22 =rs.getString(4);/ Stringe22 =rs.getString(5);/Stringf22 =rs.getString(6);System.out.println(a22+,+b22+ ,+c22+,+d22);kkk+;if(kkk=0)System.out.println(沒有這本書,請(qǐng)重新輸入);else/System.out.println(您是否真的要?jiǎng)h除? yes/no);/String k=scanner.next()

59、;/if(k.startsWith(y)StringdeleSql=DELETEFROMborrowbookWHEREbookID=+b3+;int p=stmt.executeUpdate(deleSql); /返回記錄影響的條數(shù)if(p!=0)System.out.println(刪除成功!);System.out.println(是否繼續(xù)刪除?yes/no no返回主菜單);String l=scanner.next();if(l.startsWith(yes)System.out.println();if(l.startsWith(no)ll=1;System.out.println(

60、);/*StringdeleSql=DELETEbookIDFROMborrowbookbookID=+b3+;int k=stmt.executeUpdate(deleSql); /返回記錄影響的條數(shù)if(k!=0)System.out.println(刪除成功!);*/break;case 4:int mm=0;while(mm!=1)System.out.println(4.修改借閱讀書信息:);System.out.println(請(qǐng)輸入要修改的圖書的ID );String S=scanner.next();String Ssplitst=S.split(,);String c1=Ss

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論