第一篇:VB圖書管理系統
圖書管理系統的設計與實現
目錄
一、序言······················································································································4
二、需求分析說明書 ····································································································4 2.1系統介紹..................................................................................................................................................4 2.2系統面向的用戶群體..............................................................................................................................4 2.3系統的功能性需求..................................................................................................................................4 2.4系統的非功能性需求..............................................................................................................................5 2.4.1用戶界面需求...................................................................................................................................5 2.4.2軟硬件環境需求...............................................................................................................................5 2.4.3軟件質量需求...................................................................................................................................5
三、可行性分析報告 ····································································································5 3.1技術可行性..............................................................................................................................................5 3.2人員可能性..............................................................................................................................................5 3.3時間、設備可能性..................................................................................................................................5 3.4系統工作量..............................................................................................................................................5 3.5代碼工作量..............................................................................................................................................5 3.6文檔要求..................................................................................................................................................5
四、開發環境與項目規劃 ·····························································································5 4.1開發環境..................................................................................................................................................5 4.2項目規劃與管理......................................................................................................................................5 4.2.1開發人員安排...................................................................................................................................5 4.2.2開發進度安排...................................................................................................................................6
五、軟件界面設計標準與規范 ······················································································6 5.1編寫目的..................................................................................................................................................6 5.2界面設計思想..........................................................................................................................................6 5.3界面設計原則..........................................................................................................................................6 5.4界面設計樣式..........................................................................................................................................6 5.5常見提示信息樣式..................................................................................................................................6 5.6常見錯誤信息樣式..................................................................................................................................7 5.7其他界面約定..........................................................................................................................................7
六、軟件編碼設計標準與規范 ······················································································7 6.1對象命名約定..........................................................................................................................................7 6.2常量和變量命名約定..............................................................................................................................8 6.3結構化編碼約定......................................................................................................................................8 6.4數據源的約定..........................................................................................................................................9 6.5數據庫訪問約定......................................................................................................................................9 6.6其他約定..................................................................................................................................................9
七、數據庫分析與設計·································································································10 7.1數據庫環境說明.......................................................................................................................................10 7.2數據庫命名標準與規范...........................................................................................................................10 7.3數據庫邏輯設計.......................................................................................................................................10 7.4數據庫物理設計.......................................................................................................................................10 7.4.1表、視圖匯總...................................................................................................................................10 7.4.2各表、視圖設計詳解.......................................................................................................................11
八、軟件體系結構設計說明書 ······················································································15 8.1系統概述..................................................................................................................................................15 8.2設計約束..................................................................................................................................................15 8.3設計策略..................................................................................................................................................15 8.4系統概要設計說明書..............................................................................................................................16 8.4.1圖例說明...........................................................................................................................................16 8.4.2系統總體結構圖...............................................................................................................................16 8.5系統詳細設計說明書..............................................................................................................................17 8.5.1系統模塊匯總...................................................................................................................................17 8.5.2系統核心模塊詳解...........................................................................................................................18 8.5.3系統模塊詳解...................................................................................................................................28
九、用戶界面設計報告·································································································42 9.1界面設計規范..........................................................................................................................................42 9.2系統窗體匯總..........................................................................................................................................42 9.3主界面設計..............................................................................................................................................43 9.4子界面設計..............................................................................................................................................43 9.5界面資源設計..........................................................................................................................................44
十、軟件測試分析報告·································································································44 10.1測試范圍與主要內容............................................................................................................................44 10.2測試方法................................................................................................................................................44 10.3測試報告................................................................................................................................................44 10.4改進建議與措施....................................................................................................................................45
十一、軟件使用說明書·································································································45 11.1軟件概述.................................................................................................................................................45 11.2使用說明.................................................................................................................................................45 11.2.1系統登陸..........................................................................................................................................45 11.2.2系統退出..........................................................................................................................................46 11.2.3圖書類別管理..................................................................................................................................46 11.2.4圖書信息管理..................................................................................................................................48 11.2.5查詢圖書信息..................................................................................................................................48 11.2.6讀者類別管理..................................................................................................................................49 11.2.7讀者信息管理..................................................................................................................................49 11.2.8查詢讀者信息..................................................................................................................................50 11.2.9借書管理..........................................................................................................................................50 11.2.10還書管理........................................................................................................................................50 參考資料······················································································································51
一、序言
圖書管理系統的設計與推出是多方面原因促成的,比如學校的圖書管理,日常管理工作 1 都是人工操作,歷史數據很難保存和利用。而其他的小型圖書館大多如此。針對這種狀況,我計劃開發一個面向小型圖書館的圖書管理系統,實現對人員、物流的全面管理,以幫助這些圖書館早日實現書店管理信息化。
為了系統的順利開發和維護,特編制如下技術文檔:
想要全部 請加QQ:76536415 專業設計 畢業論文
第二篇:vb圖書管理系統源代碼
Borbook:
Public sqltxt As String Public rno As String
'保存讀者借書證號 Public bno As String
'保存讀者圖書編號 Public xm As String
'保存讀者姓名 Public dw As String
'保存讀者單位 Public rs As ADODB.Recordset
Private Sub Comm1_Click()
rno = Trim(Text1(0).Text)
If rno = “" Then
MsgBox ”借書證號不能為空,請輸入“, vbOKOnly, ”信息提示“
Comm2.Enabled = False
Else
sqltxt = ”select * from reader where 借書證號='“ + rno + ”'“
Set rs = exesql(sqltxt)
If rs.RecordCount = 0 Then
MsgBox ”該讀者未登記,不能借書“, vbOKOnly, ”信息提示“
Comm2.Enabled = False
Else
Text2(0).Text = rs.Fields(”姓名“)
Text2(1).Text = str(rs.Fields(”借書總數“))
Text2(2).Text = str(rs.Fields(”借書總數“)rs.Fields(”已借書數“))
End If
End If
End If End Sub
Private Sub retCom_Click()
Unload Me End Sub
Private Sub Form_Load()
Comm2.Enabled = False End Sub
Edbook:
Private Sub DataGrid1_Click()
End Sub
Private Sub Form_Load()
'說明:為什么使用recs,而不直接使用adodc1.recordset.recordcount?在調用edbook1窗體添加一個記錄(確定)后,再
'返回到本表單,若不在Form_Activate()事件過程中調用adodc1.refresh進行刷新,adodc1.recordset.recordcount值
'仍未增1,這樣調用encomm過程時出錯;若在Form_Activate()事件過程中調用adodc1.refresh進行刷新,'adodc1.recordset.recordcount值增1了,調用encomm過程時也正確,但返回本窗體時,當前行總是第一行,顯然也不行,'因為用戶在添加或修改后希望在datagrid1中顯示當前操作的那條記錄.recs = Adodc1.Recordset.RecordCount End Sub
Private Sub Form_Activate()
DataGrid1.SetFocus
Call encomm End Sub
Private Sub Comm1_Click()
flag = 1
edbook1.Show vbModal End Sub
Private Sub Comm2_Click()
flag = 2
edbook1.Show vbModal End Sub
Private Sub Comm3_Click()
If MsgBox(”真的要刪除[“ + Trim(Adodc1.Recordset.Fields(”書名“))+ ”]嗎?“, vbYesNo, ”信息提示“)= vbYes Then
Adodc1.Recordset.Delete
recs = recs1
Call encomm
End If End Sub
Private Sub Comm4_Click()
Unload Me End Sub
Private Sub encomm()
If recs = 0 Then
Comm2.Enabled = False
Comm3.Enabled = False
Else
Comm2.Enabled = True
Comm3.Enabled = True
End If End Sub
Edlev1:
Dim cond As String
Private Sub Form_Load()
If flag = 2 Then
Text1(0).Text = edlev.Adodc1.Recordset.Fields(”級別“)
Text1(1).Text = edlev.Adodc1.Recordset.Fields(”過期罰款“)
Text1(2).Text = edlev.Adodc1.Recordset.Fields(”借書總數“)
Text1(3).Text = edlev.Adodc1.Recordset.Fields(”借書天數“)
End If End Sub
Private Sub Comm1_Click()
If Trim(Text1(0).Text)= ”“ Or Trim(Text1(1).Text)= ”“ Or Trim(Text1(2).Text)= ”“ Or _
Trim(Text1(3).Text)= ”“ Then
MsgBox ”數據項不全,請重新設置“, vbOKOnly, ”信息提示“
Text1(0).SetFocus
Exit Sub
End If
If flag = 1 Then '添加操作
If edlev.Adodc1.Recordset.RecordCount > 0 Then '原記錄個數大于0
cond = ”級別='“ + Trim(Text1(0).Text)+ ”'“
edlev.Adodc1.Recordset.MoveFirst
'每次從頭開始查找
edlev.Adodc1.Recordset.Find(cond)
If Not edlev.Adodc1.Recordset.EOF()Then
MsgBox ”存在完全相同的記錄“, vbOKOnly, ”信息提示“
Text1(0).SetFocus
Exit Sub
End If
End If
edlev.Adodc1.Recordset.AddNew
edlev.Adodc1.Recordset.Fields(”級別“)= Trim(Text1(0).Text)
edlev.Adodc1.Recordset.Fields(”過期罰款“)= Val(Trim(Text1(1).Text))
edlev.Adodc1.Recordset.Fields(”借書總數“)= Val(Trim(Text1(2).Text))
edlev.Adodc1.Recordset.Fields(”借書天數“)= Val(Trim(Text1(3).Text))
edlev.Adodc1.Recordset.Update
recs = recs + 1
Else
'修改操作
n = edlev.Adodc1.Recordset.AbsolutePosition
cond = ”級別='“ + Trim(Text1(0).Text)+ ”'“
edlev.Adodc1.Recordset.MoveFirst '每次從頭開始查找
edlev.Adodc1.Recordset.Find(cond)
If Not edlev.Adodc1.Recordset.EOF()And edlev.Adodc1.Recordset.AbsolutePosition <> n Then
MsgBox ”存在完全相同的記錄“, vbOKOnly, ”信息提示“
edlev.Adodc1.Recordset.MoveFirst
'這兩個語句恢復原記錄位置
edlev.Adodc1.Recordset.Move(n1)
edlev.Adodc1.Recordset.Fields(”級別“)= Trim(Text1(0).Text)
edlev.Adodc1.Recordset.Fields(”過期罰款“)= Val(Trim(Text1(1).Text))
edlev.Adodc1.Recordset.Fields(”借書總數“)= Val(Trim(Text1(2).Text))
edlev.Adodc1.Recordset.Fields(”借書天數“)= Val(Trim(Text1(3).Text))
edlev.Adodc1.Recordset.Update
End If
Unload Me End Sub
Private Sub Comm2_Click()
Unload Me End Sub
Edreader:
Private Sub DataGrid1_Click()
End Sub
Private Sub Form_Load()
recs = Adodc1.Recordset.RecordCount End Sub
Private Sub Form_Activate()
DataGrid1.SetFocus
Call encomm End Sub
Private Sub Comm1_Click()
flag = 1
edreader1.Show vbModal End Sub
Private Sub Comm2_Click()
flag = 2
edreader1.Show vbModal End Sub
Private Sub Comm3_Click()
If MsgBox(”真的要刪除[“ + Trim(Adodc1.Recordset.Fields(”姓名“))+ ”]嗎?“, vbYesNo, ”信息提示“)= vbYes Then
Adodc1.Recordset.Delete
recs = recs1
Call encomm
End If End Sub Private Sub Comm4_Click()
Adodc1.Recordset.UpdateBatch
Adodc1.Recordset.Close
Unload Me End Sub Private Sub encomm()
If recs = 0 Then
Comm2.Enabled = False
Comm3.Enabled = False
Else
Comm2.Enabled = True
Comm3.Enabled = True
End If End Sub
Edrec1:
Dim cond As String
Private Sub Form_Load()
Label1.Caption = cap
If flag = 1 Then
Text1.Text = ”“
Else
Text1.Text = edrec.Adodc1.Recordset.Fields(”fn“)
End If End Sub
Private Sub Comm1_Click()
If Trim(Text1.Text)= ”“ Then
MsgBox ”數據項不能為空,請重新設置“, vbOKOnly, ”信息提示“
Text1.SetFocus
Exit Sub
End If
If flag = 1 Then '添加操作
If edrec.Adodc1.Recordset.RecordCount > 0 Then '原記錄個數大于0
cond = ”fn='“ + Trim(Text1.Text)+ ”'“
edrec.Adodc1.Recordset.MoveFirst
'每次從頭開始查找
edrec.Adodc1.Recordset.Find(cond)
If Not edrec.Adodc1.Recordset.EOF()Then
MsgBox ”存在完全相同的記錄“, vbOKOnly, ”信息提示“
Text1.SetFocus
Exit Sub
End If
End If
edrec.Adodc1.Recordset.AddNew
edrec.Adodc1.Recordset.Fields(”fn“)= Trim(Text1.Text)
edrec.Adodc1.Recordset.Update
recs = recs + 1
Else
'修改操作
n = edrec.Adodc1.Recordset.AbsolutePosition
cond = ”fn='“ + Trim(Text1.Text)+ ”'“
edrec.Adodc1.Recordset.MoveFirst '每次從頭開始查找
edrec.Adodc1.Recordset.Find(cond)
If Not edrec.Adodc1.Recordset.EOF()And edrec.Adodc1.Recordset.AbsolutePosition <> n Then
MsgBox ”存在完全相同的記錄“, vbOKOnly, ”信息提示“
edrec.Adodc1.Recordset.MoveFirst
'這兩個語句恢復原記錄位置
edrec.Adodc1.Recordset.Move(n1)
edrec.Adodc1.Recordset.Fields(”fn“)= Trim(Text1.Text)
edrec.Adodc1.Recordset.Update
End If
Unload Me End Sub
Private Sub Comm2_Click()
Unload Me End Sub
Menu:
Private Sub MDIForm_Load()
If Not userlevel = ”系統管理員“ Then
menu21.Enabled = False
menu31.Enabled = False
menu41.Enabled = False
menu42.Enabled = False
End If End Sub
Private Sub menu11_Click()
borbook.Show vbModal End Sub
Private Sub menu12_Click()
retbook.Show vbModal End Sub
Private Sub menu13_Click()
End End Sub
Private Sub menu21_Click()
edbook.Show vbModal End Sub
Private Sub menu22_Click()
qubook.Show vbModal End Sub
Private Sub menu31_Click()
edreader.Show vbModal End Sub
Private Sub menu32_Click()
qureader.Show vbModal End Sub
Private Sub menu41_Click()
setuser.Show vbModal End Sub
Private Sub menu42_Click()
If MsgBox(”本功能要清除系統中所有數據,真的初始化嗎?“, vbYesNo, ”確認初始化操作“)
= vbYes Then
Call deldata(”book“)Call deldata(”reader“)Call deldata(”borrow“)Call deldata(”rlevel“)
Call deldata(”depart“)
Call deldata(”press“)
Call deldata(”oper“)
MsgBox ”系統初始化完畢,下次只能以1234/1234(用戶名/口令)進入本系統“, vbOKOnly, ”信息提示“
End If End Sub
Pass:
Public n As Integer
Private Sub Command1_Click()
Dim mrc As ADODB.Recordset
txtsql = ”select * from oper where 用戶名='“ & _
Trim$(Text1(0).Text)& ”'“ & ” And 口令 = '“ & Trim$(Text1(1).Text)+ ”'“
Set mrc = exesql(txtsql)
If mrc.RecordCount = 0 Then '未找到用戶記錄
n = n + 1
If n < 3 Then
MsgBox ”沒有這個用戶,繼續登錄“, vbOKOnly + vbExclamation, ”信息提示“
Text1(0).Text = ”“
Text1(1).Text = ”“
Text1(0).SetFocus
Else
MsgBox ”已登錄失敗三次,退出系統“, vbOKOnly + vbExclamation, ”信息提示“
mrc.Close
Unload Me
End If
Else
'找到合法用戶記錄
userlevel = Trim(mrc.Fields(”級別“))
mrc.Close
Unload Me
menu.Show '調用menu窗體
End If End Sub
Private Sub Command2_Click()
Unload Me End Sub
Private Sub Form_Load()
n = 0
'n保存登錄的次數 End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
Call endata(KeyAscii)End Sub
Qubook:
Private Sub Comm1_Click()
Dim sqltxt As String
If Adodc1.Recordset.Fields(”借否“)= ”借“ Then
no = Trim(Adodc1.Recordset.Fields(”圖書編號“))
sqltxt = ”select * from borrow where 圖書編號='“ + no + ”'“
Set rs = exesql(sqltxt)
If rs.RecordCount = 0 Then
MsgBox ”該圖書沒有借書記錄“, vbOKOnly, ”信息提示“
Else
MsgBox ”圖書編號:“ + no + Chr(10)+ Chr(13)+ _
”書
名:“ + Trim(rs.Fields(”書名“))+ Chr(10)+ Chr(13)+ _
”借 書 人:“ + Trim(rs.Fields(”姓名“))+ Chr(10)+ Chr(13)+ _
”單
位:“ + Trim(rs.Fields(”單位“))+ Chr(10)+ Chr(13)+ _
”借書日期:“ + Format(rs.Fields(”借書日期“), ”yyyy.mm.dd“), vbOKOnly, ”查找結果“
End If
rs.Close
Else
MsgBox ”該書沒有外借,不能顯示借書人“, vbOKOnly, ”信息提示“
End If End Sub
Private Sub Comm2_Click()
Unload Me End Sub
Private Sub Form_Activate()
Adodc1.Refresh
DataGrid1.Refresh
DataGrid1.SetFocus
Call encomm End Sub
Private Sub selcmd1_Click()'設置條件確定
Dim str As String
str = ”“
'條件表達式
If Trim(Text1(0).Text)<> ”“ Then
If str = ”“ Then
str = ”圖書編號='“ + Trim(Text1(0).Text)+ ”'“
Else
str = str + ” and 圖書編號='“ + Trim(Text1(0).Text)+ ”'“
End If
End If
If Trim(Text1(1).Text)<> ”“ Then
If str = ”“ Then
str = ”書名='“ + Trim(Text1(1).Text)+ ”'“
Else
str = str + ” and 書名='“ + Trim(Text1(1).Text)+ ”'“
End If
End If
If Trim(Text1(2).Text)<> ”“ Then
If str = ”“ Then
str = ”作者='“ + Trim(Text1(2).Text)+ ”'“
Else
str = str + ” and 作者='“ + Trim(Text1(2).Text)+ ”'“
End If
End If
If Trim(Text1(3).Text)<> ”“ Then
If str = ”“ Then
str = ”出版社='“ + Trim(Text1(3).Text)+ ”'“
Else
str = str + ” and 出版社='“ + Trim(Text1(3).Text)+ ”'“
End If
End If
If Trim(Text1(4).Text)<> ”“ Then
If str = ”“ Then
str = ”借否='“ + Trim(Text1(4).Text)+ ”'“
Else
str = str + ” and 借否='“ + Trim(Text1(4).Text)+ ”'“
End If
End If
If Trim(Text1(5).Text)<> ”“ Then
If str = ”“ Then
str = ”定價=“ + Trim(Text1(5).Text)
Else
str = str + ” and 定價=“ + Trim(Text1(5).Text)
End If
End If
If str <> ”“ Then
Adodc1.RecordSource = ”select * from book where “ + str
Adodc1.Refresh
Else
Adodc1.RecordSource = ”select * from book“
Adodc1.Refresh
End If
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox ”沒有任何滿足條件的記錄“, vbOKOnly, ”信息提示“
End If
Call encomm End Sub
Private Sub selcmd2_Click()'設置條件重置
Text1(0).Text = ”“
Text1(1).Text = ”“
Text1(2).Text = ”“
Text1(3).Text = ”“
Text1(4).Text = ”“
Text1(5).Text = ”“ End Sub
Private Sub encomm()'自定義子過程:判斷Adodc1中是否存在記錄
If Adodc1.Recordset.RecordCount = 0 Then
Comm1.Enabled = False
Else
Comm1.Enabled = True
End If End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
Call endata(KeyAscii)End Sub
Qureader:
Private Sub Comm1_Click()
Dim strn As String
Dim sqltxt As String
no = Trim(Adodc1.Recordset.Fields(”借書證號“))
sqltxt = ”select * from borrow where 借書證號='“ + no + ”'“
Set rs = exesql(sqltxt)
If rs.RecordCount = 0 Then
MsgBox ”該讀者沒有借任何圖書“, vbOKOnly, ”信息提示“
Else
rs.MoveFirst
strn = ”書
名(借書日期)“ + Chr(10)+ Chr(13)
Do While Not rs.EOF()
strn = strn & Trim(rs.Fields(”書名“))& ”(“ & Format(rs.Fields(”借書日期“), ”yyyy.mm.dd“)& ”)“ + Chr(10)+ Chr(13)
rs.MoveNext
Loop
MsgBox strn, vbOKOnly, ”列所借圖書清單“
rs.Close
End If End Sub
Private Sub Comm2_Click()
Unload Me End Sub
Private Sub Form_Activate()
Adodc1.Refresh
DataGrid1.Refresh
DataGrid1.SetFocus
Call encomm End Sub
Private Sub selcmd1_Click()'設置條件確定
Dim str As String
str = ”“
'條件表達式
If Trim(Text1(0).Text)<> ”“ Then
If str = ”“ Then
str = ”借書證號='“ + Trim(Text1(0).Text)+ ”'“
Else
str = str + ” and 借書證號='“ + Trim(Text1(0).Text)+ ”'“
End If
End If
If Trim(Text1(1).Text)<> ”“ Then
If str = ”“ Then
str = ”姓名='“ + Trim(Text1(1).Text)+ ”'“
Else
str = str + ” and 姓名='“ + Trim(Text1(1).Text)+ ”'“
End If
End If
If Trim(Text1(2).Text)<> ”“ Then
If str = ”“ Then
str = ”單位='“ + Trim(Text1(2).Text)+ ”'“
Else
str = str + ” and 單位='“ + Trim(Text1(2).Text)+ ”'“
End If
End If
If Trim(Text1(3).Text)<> ”“ Then
If str = ”“ Then
str = ”級別='“ + Trim(Text1(3).Text)+ ”'“
Else
str = str + ” and 級別='“ + Trim(Text1(3).Text)+ ”'“
End If
End If
If Trim(Text1(4).Text)<> ”“ Then
If str = ”“ Then
str = ”性別='“ + Trim(Text1(4).Text)+ ”'“
Else
str = str + ” and 性別='“ + Trim(Text1(4).Text)+ ”'“
End If
End If
If str <> ”“ Then
Adodc1.RecordSource = ”select * from reader where “ + str
Adodc1.Refresh
Else
Adodc1.RecordSource = ”select * from reader“
Adodc1.Refresh
End If
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox ”沒有任何滿足條件的記錄“, vbOKOnly, ”信息提示“
End If
Call encomm End Sub
Private Sub selcmd2_Click()'設置條件重置
Text1(0).Text = ”“
Text1(1).Text = ”“
Text1(2).Text = ”“
Text1(3).Text = ”“
Text1(4).Text = ”“ End Sub
Private Sub encomm()'自定義子過程:判斷Adodc1中是否存在記錄
If Adodc1.Recordset.RecordCount = 0 Then
Comm1.Enabled = False
Else
Comm1.Enabled = True
End If End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
Call endata(KeyAscii)End Sub
Retbook:
Public rno As String Public bno As String
Private Sub Comm1_Click()
bno = Trim(Text1.Text)
If bno <> ”“ Then
Dim sqltxt As String
sqltxt = ”select * from borrow where 圖書編號='“ + bno + ”'“
Set brs = exesql(sqltxt)
If brs.RecordCount = 0 Then
MsgBox ”該書不是從本圖書館所借的,不能歸還!“, vbOKOnly, ”信息提示“
Else
If Trim(brs.Fields(”借書證號“))<> rno Then
If rno <> ”“ Then
'另一讀者還書,自動列出上一個還書人的罰款單
dstr = ”罰款單“ + Chr(10)+ Chr(13)
dstr = dstr & ”姓名:“ & Trim(Text2(1).Text)+ ”(“ + rno + ”)罰款總額:“ & str(Text2(4).Text)& ”元“
MsgBox dstr, vbOKOnly, ”列罰款單“
End If
rno = Trim(brs.Fields(”借書證號“))
sqltxt = ”select * from book where 圖書編號='“ + bno + ”'“ '處理圖書記錄
Set bs = exesql(sqltxt)
bs.Fields(”借否“)= ”否“
bs.Update
sqltxt = ”select * from reader where 借書證號='“ + rno + ”'“ '處理讀者記錄
Set rs = exesql(sqltxt)
rs.Fields(”已借書數“)= rs.Fields(”已借書數“)rs.Fields(”已借書數“)
If(Datebrs.Fields(”借書日期“)1
rs.Update
If(Datebrs.Fields(”借書日期“)1
Call encomm
End If End Sub
Private Sub Comm4_Click()
Unload Me End Sub
Private Sub encomm()
If recs = 0 Then
Comm2.Enabled = False
Comm3.Enabled = False
Else
Comm2.Enabled = True
Comm3.Enabled = True
End If End Sub
Setuser1:
Dim cond As String
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys ”{TAB}“
End If End Sub
Private Sub Form_Load()
If flag = 2 Then
Text1(0).Text = setuser.Adodc1.Recordset.Fields(”用戶名“)
Text1(1).Text = setuser.Adodc1.Recordset.Fields(”口令“)
Combo1.Text = setuser.Adodc1.Recordset.Fields(”級別“)
End If End Sub
Private Sub Comm1_Click()
If Trim(Text1(0).Text)= ”“ Or Trim(Text1(1).Text)= ”“ Or Trim(Combo1.Text)= ”“ Then
MsgBox ”數據項不全,請重新設置“, vbOKOnly, ”信息提示“
Text1(0).SetFocus
Exit Sub
End If
If flag = 1 Then '添加操作
If setuser.Adodc1.Recordset.RecordCount > 0 Then '原記錄個數大于0
cond = ”級別='“ + Trim(Text1(0).Text)+ ”'“
setuser.Adodc1.Recordset.MoveFirst
'每次從頭開始查找
setuser.Adodc1.Recordset.Find(cond)
If Not setuser.Adodc1.Recordset.EOF()Then
MsgBox ”存在完全相同的記錄“, vbOKOnly, ”信息提示“
Text1(0).SetFocus
Exit Sub
End If
End If
setuser.Adodc1.Recordset.AddNew
setuser.Adodc1.Recordset.Fields(”用戶名“)= Trim(Text1(0).Text)
setuser.Adodc1.Recordset.Fields(”口令“)= Val(Trim(Text1(1).Text))
setuser.Adodc1.Recordset.Fields(”級別“)= Trim(Combo1.Text)
setuser.Adodc1.Recordset.Update
recs = recs + 1
Else
'修改操作
n = setuser.Adodc1.Recordset.AbsolutePosition
cond = ”級別='“ + Trim(Text1(0).Text)+ ”'“
setuser.Adodc1.Recordset.MoveFirst '每次從頭開始查找
setuser.Adodc1.Recordset.Find(cond)
If Not setuser.Adodc1.Recordset.EOF()And setuser.Adodc1.Recordset.AbsolutePosition <> n Then
MsgBox ”存在完全相同的記錄“, vbOKOnly, ”信息提示“
setuser.Adodc1.Recordset.MoveFirst
'這兩個語句恢復原記錄位置
setuser.Adodc1.Recordset.Move(n1)
setuser.Adodc1.Recordset.Fields(”用戶名“)= Trim(Text1(0).Text)
setuser.Adodc1.Recordset.Fields(”口令“)= Val(Trim(Text1(1).Text))
setuser.Adodc1.Recordset.Fields(”級別“)= Trim(Combo1.Text)
setuser.Adodc1.Recordset.Update
End If
Unload Me End Sub
Private Sub Comm2_Click()
Unload Me End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
Call endata(KeyAscii)End Sub
模塊:
Public userlevel As String '保存用戶級別
Public flag As Integer
'用作記錄操作標記
Public tna As String
'保存表名:用于調用edrec1窗體 Public cap As String
'保存標題名:用于調用edrec1窗體 Public recs As Integer
'保存記錄集中記錄個數
Sub main()
pass.Show vbModal End Sub
Public Function exesql(ByVal sql As String)As ADODB.Recordset
sql = Trim$(sql)
Set conn = New ADODB.Connection
Set rst = New ADODB.Recordset
conn.ConnectionString = ”DSN=Library;UID=sa;PWD=;“
conn.Open
Set rst.ActiveConnection = conn
rst.LockType = adLockOptimistic
rst.CursorType = adOpenKeyset
rst.Open sql
Set exesql = rst
Set rst = Nothing
Set conn = Nothing End Function
Public Sub deldata(ByVal tn As String)刪除指定表中所有記錄,對于oper表添加一個系統用戶
Dim sql As String
sql = ”delete “ & Trim$(tn)
Set conn = New ADODB.Connection
conn.ConnectionString = ”DSN=Library;UID=sa;PWD=;“
conn.Open
conn.Execute sql
If Trim(tn)= ”oper“ Then
sql = ”insert oper values('1234','1234','系統管理員')“
conn.Execute sql
End If
conn.Close End Sub Public Sub endata(Keyasc As Integer)
If Keyasc = 13 Then
SendKeys ”{TAB}" '將回車鍵轉換成Tab鍵
End If End Sub
第三篇:VB 圖書管理系統 畢業設計 外文翻譯
學院畢業設計(論文)譯文專用紙 第 1 頁
現在送(畢業設計論文、文獻綜述、外文翻譯、開題報告、答辯PPT)
都可以直接下載
源程序因為無法上傳百度,需要者去空間留言
學院畢業設計(論文)譯文專用紙 第 2 頁
譯文:
Visual Basic 語言與算法
1991年,美國微軟公司推出了Visual Basic(可簡稱VB),目前的最新版本是VB 2008 Beta2(VB9)中文版。
Visual 意即可視的、可見的,指的是開發像windows操作系統的圖形用戶界面(Graphic User Interface,GUI)的方法,它不需要編寫大量代碼去描述界面元素的外觀和位置,只要把預先建立好的對象拖放到屏幕上相應的位置即可。
Basic 實際上是一個短語的縮寫,這個短語就是 Beginners all_purpose symbolic instruction code,其中文意思為“初始者通用符號指令代碼語言”。Visual Basic有學習版、專業版和企業版三種版本,以滿足不同的開發需要。學習版適用于普通學習者及大多數使用Visual Basic開發一般Windows應用程序的人員,但是;專業版適用于計算機專業開發人員,包括了學習版的全部內容功能以及Internet控件開發工具之類的高級特性;企業版除包含專業版全部的內容外,還有自動化構件管理器等工具,使得專業編程人員能夠開發功能強大的組骨子里分布式應用程序。
Visual Basic
第1節Visual Basic的概述
Microsoft Visual Basic(簡稱VB)是在Windows操作平臺下設計應用程序的最速度、最簡捷的工具之一。不論是初學者還是專業開發人員,VB都為他們提供了一整套的工具,可以輕松方便的開發應用程序。因此,VB一直被作為大多數電腦初學者的首選入門編程語言。
“Visual”指的是采用可視化的開發圖形用戶界面(GUI)的方法,一般不需要編寫大量代碼去描述界面元素的外觀和位置,而只要把需要的控件拖放到屏幕上的相應位置即可方便圖形設計圖形用戶界面;“Basic”指的是 BASIC語言,因為VB是在原有的BAISC語言的基礎上發展起來的。
VB是 Microsoft的一種通用程序設計語言,它包括在 Microsoft Excel、Microsoft Access等眾多Windows應用軟件中的VBA都使用VB語言,以供用戶進行二次開發;目前制作網頁使用較多的VBScript腳本語言也是VB的子集。
學院畢業設計(論文)譯文專用紙 第 3 頁
利用VB的數據訪問特性用戶可以對包括 Microsoft SQL Server和其他企業數據庫在內的大部分數據庫格式創建數據庫和前端應用程序,以及可調整的服務端部件。利用ActiveX(TM)技術,VB可使用 Microsoft Word字處理器、Microsoft Excel電子數據表極其他Windows應用程序提供的功能,甚至可直接使用由VB專業版或企業版創建的應用程序和對象。
用戶最終創建的程序是一個真正的.EXE文件,可以自由發布。
VB提供了學習版,專業版和企業版,用以滿足不同的開發需求。學習版使編程人員很容易地開發Windows和Windows NT的應用程序。專業版為專業編程人員提供了功能完備的開發工具,專業版中包含了學習版的所有功能。企業版允許專業人員以小組的形式來創建強大的分布式應用程序。它包括專業版的所有的特性。所以可以根據不同的需要來選擇不同的版本。
第2節集成開發環境
VB的集成環境或稱IDE,由多個部分組成,包含了標題欄、菜單欄、工具欄、控件箱,以及窗體設計器窗口、工程管理器窗口、屬性窗口、代碼窗口和窗體布局窗體布局等。覆蓋了開發應用程序的設計、編輯、編譯和調試等所有功能。
在VB中,應用程序也稱工程。當第一次啟動VB并打開一個新工程時,可以看到如圖所示的集成開發環境界面。
Visual Basic 集成開發環境
VB通過工程來組織應用程序的開發,使用工程來管理構成應用程序的所有文件。一個工程一般由若干個窗體、標準模塊以及應用環境組成。系統通過工程菜單來對工程進行管理,如添加窗體、引用等。系統允許同時打開和管理多個工程。
第3節Visual Basic語言簡介
Basic是最常被用來做入門使用的高級語言。它的全名是 Beginner’s All-purpose Sumbolic Instruction Code,簡稱為 BASIC。顧名思義,Basic就是一種專為初學者設計的語言,因其易學易懂,所以身受歡迎。早期的Basic語言都是屬于解譯式的,因此可以一行一行地執行,所以它可以立刻看到執行的結果,對初學者來說這是很方便的設計。不過它也因此沒有結構化的概念,在程序的維護及管理上比起其他語言困難許多。不過在后期的Basic則改正了以上的缺點(如 學院畢業設計(論文)譯文專用紙 第 4 頁
Quick Basic),使得它也可以用來開發較大型的程序。
語言是構成VB程序的基本成分。VB規定了語句格式和功能。
語法:
語句定義符[語句體]
語句定義符用于規定語句的功能,語句體指定語句的具體內容或要執行的具體操作。所有語句的集合就是VB語言,用VB語句進行有機組合完成某個特定功能就是程序。界面+程序就能解決某個應用問題。
VB應用程序代碼一般在“代碼編輯器”窗口編寫。“代碼編輯器”像是一個高度專門化的字處理軟件,有很多便于編寫VB代碼的功能,圖所示為[例Ex-Hello]在“代碼編輯器”窗口編寫的代碼。
“代碼編輯器”窗口
第4節用Visual Basic開發應用程序
使用VB編程,一般先設計應用程序的外觀,然后再分別編寫各對象事件的程序代碼或其他處理程序,編程的工作要輕松多。
創建應用程序的步驟如下:
1. 創建應用程序界面
界面是用戶和程序交互的橋梁,用VB創建的標準的WINDOWS應用程序的界面一般由窗體和按鈕、菜單、文本框的圖象框等構成。根據程序的功能要求和用戶與程序之間的信息交流的需要,來確定需要那些對象,規劃界面的布局。
2. 設計界面上各個對象的屬性
根據規劃的界面要求設置各個對象的屬性,比如對象的外貌、名稱、顏色、大小等。
大多數屬性取值既可以在設計時通過屬性窗口來設置,也可以在程序代碼中通過編程在程序運行時設置修改。
3. 編程對象響應的程序代碼
界面僅僅決定了程序的外觀,設計完界面后就要通過“代碼編輯器” 窗口來添加代碼,實現一些在接受外界信息后作出響應、信息處理等任務,添加代碼,實現一些在接受外界信息后作出的響應、信息處理等任務,添加代碼如圖的代碼編輯窗口所示
學院畢業設計(論文)譯文專用紙 第 5 頁
“代碼編輯器”窗口
4. 保存工程
一個VB程序就是一個工程,在設計一個應用程序時,系統會建立一個擴展名為.vbp的工程文件,工程文件包含了該工程所建立的所有文件的相關信息,保存工程就同時保存了該工程的所有相關文件。比如當設計界面時產生的窗體保存在擴展名為.frm和.frx的窗體文件中。在打開一個工程(文件)時,該工程有關的所有文件同時被裝載。
5. 行和調試程序
通過“運行”菜單中的選項來運行程序,當出現錯誤時,VB系統可以提供信息提示也可通過“調試”和“運行”菜單來查找和排除錯誤。
6.生成可執行程序
為了使程序可以脫離VB環境,通過“文件”菜單中的“生成工程1.exe”命令來生成可執行程序(.exe文件),此后即可直接執行該文件。在生成可+執行程序后,再通過安裝向導將所有相關文件打包,就可以作為一個軟件產品在windows 9x/2000 環境下安裝后獨立運行
VB的數據庫編程方面按其難易程度可分為三類(由易到難);●使用數據庫控制項和綁定控制項 ●使用數據庫對象變量進行編程 ●直接調用ODBC2.0API 在使用VB進行數據庫編程時,通常,會首先選擇三種基本方法之一來進行數據庫應用程序的方案設計, 現在就將以上三種設計方法的適應范圍及其優缺點進行一個比較。使用數據庫控制項和綁定控制項 1.1優點
它是三種方法中編碼量最小的 不必了解CDBC2.0API的細節
允許使用標準的和第三方廠商制訂的控制項 簡化了錯誤處理
支持所有的動態集方法及屬性
學院畢業設計(論文)譯文專用紙 第 6 頁
1.2缺點
不能存取快照對象(snapshop)對象或表格對象(都屬于記錄集對象)不能存取數據庫集合,比如表定義(TableDefs)字段(Fieds),索引(Indexes)及查詢定義(QueryDefs)只能存取部分ODBC2.0管理函數 不能進行真正的事務處理 有限的錯誤診斷功能 1.3應用
對中小規模的數據庫表(通常少于一千條記錄)只進行簡章的瀏覽操作 基本SQL查詢所對應的結果集長度有限(通常結果集的記錄數小于一百, 這些記錄從一個或兩個長度有限的表中檢索出來)應用程序的數據輸入/輸出項較少(通常只涉及一個或兩個長度有限的表、并且表中的字段數在10個左右且不具有關系完整性限制 使用數據庫對象變量進行編程 2.1 優點
可以在程序中存取ODBC2.0的管理函數
可以控制多種記錄集類型:Dynaset、Snapshop及Table記錄集合對象 可以存取存儲過程和查詢動作
可以存取數據庫集合對象,例如TableDefs、Fields、Indexes及QueryDefs 具有真正的事務處理能力 , 包括啟動事務(Begintrans)、提交事務(CommitTrans)及回滾事務(Rollback)2.2 缺點
比使用數據控制項的方法編碼量較大 只能進行間接的錯誤處理和錯誤恢復 對每個數據庫操作沒有細粒度的控制
對結果集和包含結果集的內豐資源的操作受到限制 同直接使用ODBC2.0API函數的方法相比性能較低 2.3 應用
應用程序需要在執行期間動態地建立表、字段及索引.學院畢業設計(論文)譯文專用紙 第 7 頁
應用程序涉及同步更新幾張表(但在邏輯上保持一致性)的復雜事務 應用程序使用結果集而不是Dynaset的窗體(FORMS),例如Snapshots或Tables,這里是設計要考慮的關鍵
應用程序的表非常大,多于1000條記錄
應用程序具有復雜的數據輸入/輸出項,它涉及許多內部相關的字段并且包括數據庫參照完整性或一致性規則
應用程序需要執行一些額外的操作和對結果集的查詢后處理, 尤其是需要很高的數據格式化顯示
應用程序需要利用復雜的ODBC管理功能以選擇、配置、校驗及建立各種數據源
應用程序需要在執行期間“顯示”數據庫的基本結構 應用程序需要使用復雜的多碼索引方式來檢索或更新記錄 3 直接調用ODBC2.0API 3.1 優點
可以直接參與結果集的開發、管理及規范化
對結果集游標提供了更多的控制,并且提供了更多的游標類型和執行動作 能夠確定ODBC驅動程序及SQL的一致性級別 可以更好地控制Windows的執行調度及資源利用
其他方面同其他方法差不多,因此這種方法很可能具有最好的性能 3.2 缺點
較其他兩種方法需要大量的代碼
代碼復雜并且要求程序員具有編制API調用的經驗
在網絡上Visual Basic運行期間庫的錯誤處理缺乏安全性,因此代碼運行期間出現的錯誤所造成的后果會非常嚴重
3.3 應用
如果系統環境為客戶機/服務器模式下的大規模多用戶環境,那么應用程序必須都能夠準確地解決可能出現的系統錯誤和失敗
應用程序強調資源使用,這里如何對內存、網絡服務器資源進行直接控制是首要的考慮因素
學院畢業設計(論文)譯文專用紙 第 8 頁
應用程序使用超大規模數據庫,例如數據庫表可能包含幾萬或幾十萬條記錄 計算機系統中的任何軟件,都是由大大小小的各種軟件組成部分構成,各自按照特定的算法來實現,算法的好壞直接決定所實現軟件性能的優劣。用什么方法來設計算法,所設計算法需要什么樣的資源,需要多少運行時間、多少存儲空間,如何判定一個算法的好壞,在實現一個軟件時,都是必須予以解決的。計算機系統中的操作系統、語言編譯系統、數據庫管理系統以及各種各樣的計算機應用系統中的軟件,都必須用一個個具體的算法來實現。因此,算法設計與分析是計算機科學與技術的一個核心問題。
算法是解題的步驟,我們可以把算法定義成解一確定類問題的任意一種特殊的方法。在計算機科學中,算法要用計算機算法語言描述,算法代表用計算機解一類問題的精確、有效的方法。算法+數據結構=程序,求解一個給定的可計算或可解的問題,不同的人可以編寫出不同的程序,來解決同一個問題,這里存在兩個問題:一是與計算方法密切相關的算法問題;二是程序設計的技術問題。算法和程序之間存在密切的關系。算法是一組有窮的規則,它們規定了解決某一特定類型問題的一系列運算,是對解題方案的準確與完整的描述。制定一個算法,一般要經過設計、確認、分析、編碼、測試、調試、計時等階段。對算法的學習包括五個方面的內容:
① 設計算法。算法設計工作是不可能完全自動化的,應學習了解已經被實踐證明是有用的一些基本的算法設計方法,這些基本的設計方法不僅適用于計算機科學,而且適用于電氣工程、運籌學等領域。
② 表示算法。描述算法的方法有多種形式,例如自然語言和算法語言,各自有適用的環境和特點。
③確認算法。算法確認的目的是使人們確信這一算法能夠正確無誤地工作,即該算法具有可計算性。正確的算法用計算機算法語言描述,構成計算機程序,計算機程序在計算機上運行,得到算法運算的結果。
④ 分析算法。算法分析是對一個算法需要多少計算時間和存儲空間作定量的分析。分析算法可以預測這一算法適合在什么樣的環境中有效地運行,對解決同一問題的不同算法的有效性作出比較。
學院畢業設計(論文)譯文專用紙 第 9 頁
⑤ 驗證算法。用計算機語言描述的算法是否可計算、有效合理,須對程序進行測試,測試程序的工作由調試和作時空分布圖組成。
而算法具有一定的特性,它包括:
① 確定性。算法的每一種運算必須有確定的意義,該種運算應執行何種動作應無二義性,目的明確。
② 能行性。要求算法中有待實現的運算都是基本的,每種運算至少在原理上能由人用紙和筆在有限的時間內完成。
③ 輸入。一個算法有0個或多個輸入,在算法運算開始之前給出算法所需數據的初值,這些輸入取自特定的對象集合。
④ 輸出。作為算法運算的結果,一個算法產生一個或多個輸出,輸出是同輸入有某種特定關系的量。
⑤ 有窮性。一個算法總是在執行了有窮步的運算后終止,即該算法是可達的。滿足前四個特性的一組規則不能稱為算法,只能稱為計算過程,操作系統是計算過程的一個例子,操作系統用來管理計算機資源,控制作業的運行,沒有作業運行時,計算過程并不停止,而是處于等待狀態。
算法的復雜性是算法效率的度量,在評價算法性能時,復雜性是一個重要的依據。算法的復雜性的程度與運行該算法所需要的計算機資源的多少有關,所需要的資源越多,表明該算法的復雜性越高;所需要的資源越少,表明該算法的復雜性越低。計算機的資源,最重要的是運算所需的時間和存儲程序和數據所需的空間資源,算法的復雜性有時間復雜性和空間復雜性之分。
算法在計算機上執行運算,需要一定的存儲空間存放描述算法的程序和算法所需的數據,計算機完成運算任務需要一定的時間。根據不同的算法寫出的程序放在計算機上運算時,所需要的時間和空間是不同的,算法的復雜性是對算法運算所需時間和空間的一種度量。不同的計算機其運算速度相差很大,在衡量一個算法的復雜性要注意到這一點。
對于任意給定的問題,設計出復雜性盡可能低的算法是在設計算法時考慮的一個重要目標。另外,當給定的問題已有多種算法時,選擇其中復雜性最低者,是在選用算法時應遵循的一個重要準則。因此,算法的復雜性分析對算法的設計或選用有著重要的指導意義和實用價值。
學院畢業設計(論文)譯文專用紙 第 10 頁
原文: 出處:
Visual Basic language and arithmetic The United States launched the Microsoft Visual Basic(may be referred to VB), is the latest version of the current VB 2008 Beta2(VB9)Chinese version.Visual meaning the visual, visible, referring to the development of operating systems like windows graphical user interface(Graphic User Interface, GUI)method, it does not need to prepare a large number code to describe the appearance of the interface elements and location, as long as the pre-The establishment of good drag and drop objects on the screen corresponding to the location.Basic is actually an abbreviation of the phrase;this phrase is Beginners all-purpose symbolic instruction code, the Chinese meaning “to the initial directive GM symbol code language.”
Visual Basic learning, Professional Edition and Enterprise Edition versions to meet the different needs of the development.Study and apply to the ordinary version of the majority of learners and the use of Visual Basic development of the general staff of Windows applications, but;professional version for computer professional development of staff, including the study of functional version of the full content control and Internet development tools such as advanced features ,Enterprise contain not only all the professional version of the content, there are automated tools such as Component Manager, professional programmers to make the development of a powerful group essence of distributed applications.Visual Basic
Section 1 the summary of Visual Basic
Microsoft Visual Basic,(abbreviate VB)as tool the most of application program one of under Windows operating platform.No matter beginner or professional developer, VB has all offered a whole set of tools to them, Development application program that it can be relaxed and convenient.So VB as most computer first-selected the ABC of programming language of beginner.學院畢業設計(論文)譯文專用紙 第 11 頁
“ Visual” mean method to adopt visual user of development figure interface(GUI), need and write a large number of code go and describe interface appearance and position of element seldom, Tow and show controlling part that need corresponding position to get screen can help figure design interface, user of figure,;“ Basic” means BASIC language, because VB is developed on the basis of already existing BAISC language.VB is a kind of programming language in common use of Microsoft, It, including VBA of the numerous Windows application software use VB language in Microsoft Excel, Microsoft Accessed., For users to carry on the secondary development;Make web page use more VBScript script language sub collection of VB too at present.Utilize data of VB visit characteristic user can establish the data base to most data base forms including Microsoft SQL Server and other enterprises data base With the application program of front, and adjustable service end part.Utilize ActiveX(TM)technology, VB can use word processor, electronic data list he Windows function that application program offers extremely, Excel of Microsoft, Word of Microsoft, Even can use by VB specialty edition or enterprise application program and target that edition establish directly.The procedure that users established finally is a real.EXE file , can issue freely.VB offer study edition, the specialty edition and enterprise edition, use to satisfied with different development demands.Study edition make programming personnel develop Windows and Windows application program of NT very easily.The specialty edition has offered the developing instrument with complete function to programming personnel of the specialty, Include studying all functions of edition in the specialty edition.Enterprise edition allow the professional personnel to establish strong distributed application program in the form of group.It includes all characteristics of the specialty edition.So can choose different editions according to different needs.Section 2 integrated development environments
Integrated environment of VB call IDE, made up of a lot of parts , include title board, menu fence, tool fence, controlling part case, And window body window, 學院畢業設計(論文)譯文專用紙 第 12 頁
engineering management device window, attribute window, code window and window body overall arrangement window body overall arrangement, etc.of designing etc..Have covered all functions, such as design which develops the application program, editting, compiling and debugging, etc..In VB, the application program calls the project too.When start VB and open a new project for the first time, can see and pursue integrated development environment interface that show.Visual Basic Integrated development environment
VB come and organize development of application program through project, use project come and manage and form files of application program.One project uses the environment to make up by several window bodies, standard module generally.The system manages project through the project menu, for instance add the window body, quote.System allow turn on and manage a lot of projects besides.Section 3 Visual Basic language brief introductions
Basic use and do the elementary high-level language that used often most.Its full name is Beginner' s All-purpose Symbolic Instruction Code, abbreviate as BASIC.As its name suggests, Basic one specially for language that beginner design, because it easy to learn easy to know, So the body is popular.Early Basic language to belong to and solve translating type, so can carry out line by line , So it can see the result carried out at once , this is a very convenient design for beginner.But it have concept of structure either, one that is in procedure maintain and management have as much as other language problems.But back-end Basic correct shortcoming of the above(such as Quick Basic), make it may used for and develop the large-scaler procedure too.The language is the basic composition, which forms VB procedure.VB has stipulated the form of sentences and function.Grammar:
The sentence defines incantations [Sentence body]
Sentence define agree with and used in fixed function of sentence, sentence body appoint concrete content or want concrete operation that carry out of sentence.All set of sentence VB language, carry on with VB sentence organic association finish a 學院畢業設計(論文)譯文專用紙 第 13 頁
certain specific function the procedure.Interface + procedure can solve a certain application problem.VB application program code window write in“ code editing machine” generally.“ editing machine of code” is like the word processing software of a piece of height specialization, there are many easies function of writing VB code, Pursue to show [Example Ex-Hello ]In“ code editing machine” code that window written.“Editing machine of code” window
Section 4 develop the application program with Visual Basic
Use VB programming, design appearance of application program first generally, write every target procedure code or other treatment procedure of incident respectively, Work of programming should be light more.The procedure of establishing the application program is as follows: Establish application program interface
The interface is the mutual bridge of user and procedure, Generally formed of window body and vision frame of the button, menu, text frameset.with standard WINDOWS interface of application program that VB establish.Require according to function of procedure and user and need of information interchange of procedure, Come to confirm that need those targets , plan the overall arrangement of the interface.2.Design by each attributes of target in interface
Demand and set up each attribute of target such as appearance, name, size of targeted.according to interface of planning.Most attribute person who fetch can set up through the attribute window when design already, Too can set up revising when operating in procedure through programming in procedure code.Have the targets respond programming by procedure code
3.Respond procedure code of programming target
Interface determine appearance of procedure only, design window add codes through“ code editing machine” soon after the interface, Realize some make the tasks, such as responding, information processing,etc.after accepting external message, Add 學院畢業設計(論文)譯文專用紙 第 14 頁
code , realize some response, information processing that make after accepting external information task, As editor's window of code pursued shows add codes
“code editing machine” window
4.Keep project
One VB procedure one project, at the time of designing a application program, system will set up one be expanded and called.Project file of vbp, project file include all relevant information of file that project set up this, Keep project keep associated documents of project this at the same time.For example the window body produced when design interfaces is kept and being expanded and being called.Frm sum.In the window body of foxfire.At the time of opening a project(file), this project relevant files load at the same time.5.Operate and debugged by procedure
Operate the procedure thoroughpin operate“ selecting in the menu, when the mistake appears, VB system can offer information prompt can looked for and get rid of the mistake thoroughpin debug” within operate“ menus too.6.Can produce by executive program
For make procedure can break away from VB environment, order to become next life through” file“" producing project 1.exe” of menu but executive program(eyeful), Can carry out this file directly after this.In produce, + executive program, and then through install guide bale all associated documents, Can run independently after installation under the environment of windows 9 x/2000 as a software product.In computer system's any software, is by the every large or small each kind of software constituent constitution, defers to the specific algorithm to realize respectively, the algorithm quality direct decision realizes the software performance fit and unfit quality.Designs the algorithm with any method, what resources designs the algorithm to need, requires how many running time, how many storage space, how to determine an algorithm the quality, when realizes a software, is must give to solve.In computer system's operating system, the language compiling system, the database management system as well as in various computer application system's software, must use each one concrete algorithm to realize.Therefore, the algorithm design and 學院畢業設計(論文)譯文專用紙 第 15 頁
the analysis are the computer science and a technical core question.The algorithm is the problem-solving step, we may define the algorithm Cheng Jie a determination class question the random one special method.In the computer science, the algorithm needs to use the computer algorithmic language to describe, the algorithm represents with the computer solves a kind of question precisely, the effective method.The algorithm construction of data = procedure, solves one to assign may calculate or the solvable question, the different person may compile the different procedure, solves the identical problem, here has two problems: First, with computational method close related algorithm question;Second, programming technical question.Between the algorithm and the procedure has the close relationship.The algorithm is a group has the poor rule, they had stipulated solves some specific type question a series of operations, is to the problem solving plan accurate and the complete description.Formulates an algorithm, generally must pass through stages and so on design, confirmation, analysis, code, test, debugging, time.To algorithm study including five aspect contents: ① Design algorithm.The algorithm design work is impossible completely the automation, should study the understanding already by the practice to prove that was the useful some basic algorithm design method, these basic design method was not only suitable for the computer science, moreover was suitable for domains and so on electrical engineering, operations research;② Expresses the algorithm.The description algorithm's method has many kinds of forms, for example the natural language and the algorithmic language, have the suitable environment and the characteristic respectively;③Confirms the algorithm.The algorithm confirmed the goal is causes the people to believe firmly that this algorithm can work unmistakably correctly, namely this algorithm has the circularity.The correct algorithm describes with the computer algorithmic language, constitutes the computer program, the computer program moves on the computer, obtains the algorithm operation result;④ Parsing algorithm.The algorithmic analysis is requires how many computing time and the storage space to an algorithm makes the quota the analysis.The parsing 學院畢業設計(論文)譯文專用紙 第 16 頁
algorithm may forecast that what environment this algorithm does suit in moves effectively, to solves the identical question different algorithm validity to make the comparison;⑤ Confirmation algorithm.With machine language description algorithm whether can calculate effectively, reasonable, must carry on the test to the procedure, the test order work and makes the space and time distribution map by the debugging to be composed.But the algorithm has certain characteristic, it includes: ① Determinism.Algorithm each kind of operation must have the determination significance, this kind of operation should carry out what kind of movement should not to have the ambiguity, the goal is clear;② Effectiveness.Requests the operation which in the algorithm waits for realizing is basic, each kind of operation can at least completes in the principle by the human with the paper and the pen in the limited time;③ Input.An algorithm has 0 or the many inputs, before the algorithm operation starts gives the algorithm to need the data the starting value, these inputs are from the specific object set;④ Output.Does for the algorithm operation result, an algorithm has or many outputs, the output has some kind of specific relational quantity with the input;⑤ Has poor.An algorithm always after carrying out had the poor step operation has terminated, namely this algorithm was may reach.Satisfies a first four characteristic group of rule not to be able to be called the algorithm, can only be called the computational process, the operating system is a computational process example, the operating system uses for to manage the computer resources, controls the manufacture industry movement, when has not made industry the movement, the computational process does not stop, but is at the waiting status.The algorithm complexity is the algorithm efficiency measure, when appraises the algorithm performance, the complexity is an important basis.The algorithm complex degree with moves computer resources how many which this algorithm 學院畢業設計(論文)譯文專用紙 第 17 頁
needs related, needs the resources are more, indicated that this algorithm the complexity is higher;Needs the resources are less, indicated that this algorithm the complexity is lower.The spatial resources, which computer’s resources, operate most importantly, needs the time which and the stored routine and the data need, the algorithm complexity has division time complexity and the spatial complexity.The algorithm carries out the operation on the computer, needs the data which certain storage space depositing description algorithm the procedure and the algorithm need, the computer completes the operation task to require certain time.The procedure which writes according to the different algorithm places when on the computer operates, needs the time and the space are different, the algorithm complexity is needs the time and the spatial one kind of measure to the algorithm operation.The different computer its operating speed difference is very big, is weighing an algorithm the complexity to note this point.Regarding question, which assigns willfully, a profitable target which designs, the complex low algorithm is as far as possible when designs algorithm considered.Moreover, when the question, which assigns already when has many kinds of algorithms, an important criterion which choice complexity low, is when selects algorithm should follow.Therefore, the algorithm complex analysis or selects to the algorithm design has the important guiding sense and the use value.
第四篇:圖書管理系統
圖書管理系統源代碼
#include
Length();//計算鏈表長度 DblNode
象,讀入圖書館書籍數據 ofstream magFileOut;// 文件流對象,保存圖書館雜志數據 ifstream magFileIn;// 文件流對象,讀入圖書館雜志數據 ofstream readerFileOut;// 文件流對象,保存圖書館讀者數據 ifstream readerFileIn;// 文件流對象,讀入圖書館讀者數據 ofstream loanFileOut;// 文件流對象,保存圖書館借閱信息數據 ifstream loanFileIn;// 文件流對象,讀入圖書館借閱信息 ofstream managerFileOut;// 文件流對象,保存圖書館管理員數據 ifstream managerFileIn;// 文件流對象,讀入圖書館管理員數據 public: Library();// 構造函數 ~Library();//析構函數 void Run();// 圖書館類的運行函數 void CreateBibliotheca();// 創建書目 void CreateReader();// 創建讀者庫 void CreateManager();// 創建管理員信息 int ShowMainMenu();// 顯示主菜單函數 void Borrow();// 借書操作 void Return();// 還書操作 void Require();// 查詢操作 void SaveInfo();// 保存圖書館信息 void OpenInfo();// 讀入圖書館信息 };
第五篇:圖書管理系統
目錄
第一章 緒論.....................................................................................................................................1 第二章 需求分析..............................................................................................................................2
2.1任務概述............................................................................................................................2
2.1.1 圖書管理系統完成的主要目標...........................................................................2 2.1.2用戶的特點............................................................................................................3 2.2需求規定............................................................................................................................3
2.2.1對功能的規定........................................................................................................3 2.2.2讀者管理功能........................................................................................................4 2.2.3系統管理功能........................................................................................................4
第三章 概要設計.............................................................................................................................4
3.1總體設計............................................................................................................................4
3.1.1系統目標設計........................................................................................................4 3.1.2系統功能分析........................................................................................................5 3.2系統設計思想.....................................................................................................................5 3.3 系統模塊功能解析............................................................................................................5 第四章 詳細設計.............................................................................................................................6
4.1程序設計說明....................................................................................................................6
4.1.1用戶登錄模塊........................................................................................................6 4.1.2用戶添加模塊........................................................................................................7 4.1.3書籍查詢模塊........................................................................................................8 4.1.4圖書借閱模塊........................................................................................................9 4.1.5圖書歸還模塊......................................................................................................10 4.1.6新書入庫模塊......................................................................................................11 第五章 編碼與測試.......................................................................................................................13 5.1各功能模塊的實現...........................................................................................................13 5.2 測試.................................................................................................................................19 5.2.1借閱卡管理測試..................................................................................................19 5.2.2書籍管理測試......................................................................................................19 5.2.3系統管理測試......................................................................................................19 結束語.............................................................................................................................................20 致
謝...........................................................................................................................................21 參考文獻.........................................................................................................................................21
圖書管理系統
摘要:本文介紹了在VB6.0環境下采用“自上而下地總體規劃,自下而上地應用開發”的策略開發一個管理信息系統的過程。通過分析傳統的人工管理圖書館的不足,創建了一套行之有效的計算機管理圖書館的方案。文章詳細介紹了圖書管理信息系統的系統分析部分,包括可行性分析、組織機構分析、管理職能分析、業務流程分析、數據流程分析、數據字典、處理描述等等;系統設計部分主要介紹了系統功能設計和數據庫設計;系統實現部分列出了幾個主要的程序框圖,并附帶了一些主要的窗口和程序。關鍵字:圖書管理系統,VB6.0,sqlserver2000,信息系統
Library Management System Abstract:This article introduces the detailed process of exploring a management information system under the environment of VB6.0, utilizing “Top-Bottom” overall plan and a strategy according to “Bottom-Top” application and exploitation.That is to establish a set of effective scheme for library management by computer, through analyzing disadvantages of traditional library management by human resources.This article emphasizes on three sections.The system analysis section of library management information includes feasible analysis, organizing organs analysis, management function analysis, technological process of business analysis, technological process of data analysis, data dictionary, disposal description and the like.The system design section mainly focuses on system function design and data base design.And the system realization section has provided several major program charts, together with the main windows and programs.Key words: library management system, VB6.0,information system
第一章 緒論
隨著人類社會的發展,人類對知識的需求也不斷地增長。在這種形勢下,書籍就漸漸地成為人們獲取并增長知識的主要途徑,而圖書館就自然而然地在人們的生活中占據了一定的位置,如何科學地管理圖書館不但關系到讀者求知的方便程度,也關系到圖書館的發展,因此,開發一套完善的圖書館管理系統就必不可
少了。
圖書館管理系統是典型的信息管理系統,其開發主要包括后臺數據庫的建立和維護以及前端的應用程序的開發兩個方面。對于前者要求建立數據的一致性和完整性,對于后者則要求應用程序功能的完備,易用等的特點。基于上述考慮本系統主要利用VB6.0作前端的應用開發工具,利用sqlsever 作為后臺的數據庫,利用WINDOWS作為系統平臺開發的圖書管理系統。另外本圖書館管理系統利用軟件工程化思想和方法,總體上是采用結構化生命法進行系統分析和設計的,而系統實現等步驟則采用了原型法和面對對象的方法
系統開發的總目標是實現內部圖書借閱管理的系統化、規范化和自動化。能夠對圖書進行注冊登記,也就是將圖書的基本信息(如:書名、作者、價格等)預先存入數據庫中,供以后檢索。能夠對借閱人進行注冊登記,包括記錄借閱人的姓名、地址、電話等信息。提供方便的查詢方法。如:以書名、作者、出版社、出版時間(確切的時間、時間段、某一時間之前、某一時間之后)等信息進行圖書檢索,并能反映出圖書的借閱情況;以借閱人編號對借閱人信息進行檢索;以出版社名稱查詢出版社聯系方式信息。提供統計分析功能。可以展現出圖書類型比例、庫存與借出比例。提供舊書銷毀功能,對于淘汰、損壞、丟失的書目可及時對數據庫進行修改。能夠對使用該管理系統的用戶進行管理,按照不同的工作職能提供不同的功能授權。提供較為完善的差錯控制與友好的用戶界面,盡量避免誤操作。圖書館的基本功能就是為讀者提供借閱服務,讀者通過借閱這一過程,可以把圖書帶出圖書館,從而使讀者能夠更方便的瀏覽圖書。借書過程中,圖書管理員要對讀者的借書資格進行審查,對符合借書條件的讀者,允許其借書,對其借書記錄進行登記;對沒有借書資格的讀者,禁止其借書。
在VB6.0環境下采用“自上而下地總體規劃,自下而上地應用開發”的策略開發一個管理信息系統的過程。通過分析傳統的人工管理圖書館的不足,創建了一套行之有效的計算機管理圖書館的方案。文章詳細介紹了圖書管理信息系統的系統分析部分,包括可行性分析、組織機構分析、管理職能分析、業務流程分析、數據流程分析、數據字典、處理描述等等;系統設計部分主要介紹了系統功能設計和數據庫設計;系統實現部分列出了幾個主要的程序框圖,并附帶了一些主要的窗口和程序。
第二章 需求分析
2.1任務概述
2.1.1 圖書管理系統完成的主要目標
進入系統前需要身份認證、用戶名、密碼、輸入正確方可進入。用戶可以根據需要進行書庫管理。用戶可以進行借書證的辦理、查詢、掛失等操作。用戶可
以添加賬戶和修改密碼。2.1.2用戶的特點
最終用戶包括讀者(具有借閱卡的人)、圖書管理員,鑒于此軟件應用于大學圖書管理,讀者基本都是在校大學生即校職工和領導,圖書管理員都是接受過高等教育的職工,因此他們都懂得運用基本的計算機知識。大學圖書管理系統的使用頻度很高,假如一個一萬人的大學來講,每天圖書館的平均日流量為1.5萬。因此,該軟件的可靠性、可用性、可維護性顯得尤為重要。
2.2需求規定
2.2.1對功能的規定
1、圖書信息查詢/借書信息查詢:圖書館主要向讀者提供圖書借閱的服務。讀者為了借閱圖書,一般情況下,需要在借書之前查詢所要借閱的圖書情況,所以圖書館需要為讀者提供圖書查詢功能。例如,讀者可能想借閱某方面的書,但不知道圖書館在該方面有哪些圖書可供借閱,所以需要對圖書館的圖書進行查詢;或者,讀者知道想借閱的圖書信息,但不知道該圖書館是否有該書或不知道圖書在圖書館的位置、是否被借出、是否可以借閱等信息,這也需要使用圖書查詢功能。一般的圖書查詢中,讀者是通過圖書登記卡、瀏覽圖書登記卡中的信息得到圖書信息的。經過圖書查詢,讀者獲得圖書館是否有自己想要的圖書,該圖書的簡單信息以及圖書在圖書館的借閱位置等信息。
2、新書入庫:為了能正常運行,圖書館要及時更新館藏圖書。對于新書,要購進,供讀者借閱;所以要設計到圖書的批量入庫。對于批量入庫,圖書管理員要批量登記圖書的信息,包括書名ID、ISBN、圖書名稱、作者、出版社、單價、入庫時間、圖書總量、現存總量等。
3、借閱圖書/歸還圖書:圖書館的基本功能之一就是為讀者提供借閱服務,讀者通過借閱這一過程,可以把圖書帶出圖書館,從而使讀者能夠更方便的瀏覽圖書。借書過程中,圖書管理員要對讀者的借書資格進行審查,對符合借書條件的讀者,允許其借書,對其借書記錄進行登記;對沒有借書資格的讀者,禁止其借書。具體的步驟如下:讀者向圖書管理員提交請求和圖書借閱卡,圖書管理員檢查讀者提供的借閱卡,如果該借閱證真實準確,讀者已經借閱的圖書并沒有超過允許借書量,而且讀者沒有逾期未還的圖書,則允許讀者借書,否則,讀者不能從圖書館借書。讀者拿到要借閱的圖書,同時拿到自己的借閱卡,借書過程完畢。當借閱圖書的數量超過5本或者出現未按期歸還圖書的情況,則不好進行借閱處理。圖書館的另一基本功能就是為讀者提供還書服務,讀者在一本圖書借閱期滿之前把該圖書還給圖書館,一般的還書步驟如下:讀者把所借的圖書和自己的借閱卡交給圖書管理員。圖書管理員對圖書進行檢查,看有無損壞,如果出現圖書的損壞情況,讀者應進行相應的賠償。圖書管理員查看是否超過規定借閱期限,如果已經過期,則讀者要按規定交納罰金。圖書管理員進行登記,同時把還書信息記入借閱卡。讀者拿回自己的借閱卡,還書過程借書。讀者逾期未歸還圖書超過三天,將按照每本每天進行一定的罰款。
4、書籍掛失:對圖書由于丟失而不能即時還書的情況,讀者要即時到圖書管理員進行登記,確保圖書信息的更新。進行書籍掛失的步驟一般如下:讀者將所丟圖書信息告訴圖書管理員并將借閱卡交給圖書管理員。圖書管理員對該圖書信息進行登記,并按圖書的價格,要求讀者進行相應賠償。圖書管理員將信息記入借閱卡。讀者拿回自己的借閱卡,掛失功能結束。
2.2.2讀者管理功能
1、辦理借閱卡:圖書館向讀者提供借閱服務,讀者必須具有有效憑證方可借閱。因此,讀者必須辦理借閱卡獲取有效憑證。讀者在辦理借閱卡時,必須輸入個人有關注冊信息,包括讀者姓名、性別、出生日期、家庭住址、身份證號碼、電話號碼等信息。系統根據讀者提供的信息,辦理借閱卡并生成個人帳號、讀者可自行修改密碼。
2、借閱卡信息查詢;圖書館在正常運營中要面對大量的讀者信息,需要掌握每個讀者的信息,即時準確的掌握讀者的基本情況,這些是圖書館運營的保證。讀者要進行信息查詢,可以通過系統將自己的借閱卡賬戶、密碼輸入系統,系統通過核對找到讀者的信息。如果讀者的信息正確,系統將讀者的信息包括讀者姓名、性別、出生日期、家庭住址、身份證號碼、電話號碼等信息。如果讀者的信息不正確,系統將提示錯誤,并且系統設定,當錯誤次數超過5次時,系統將不予查詢。
3、借閱卡掛失:對借閱卡的丟失要即時進行掛失處理,以防止其他人盜用自己的有效信息并出現私自借書等行為。借閱卡掛失的一般步驟可分為:讀者將掛失情況即時到圖書管理員處進行登記,并填寫登記單。圖書管理員將讀者情況進行登記掛失,注銷借閱卡的信息,并咨詢讀者是否重新辦理。若讀者需重新辦理,則重新填寫相關信息,系統自動生成心的借閱卡信息記錄,讀者重新設置帳號即密碼,并交納相應的費用。若讀者不需辦理,則系統將信息注銷。讀者獲得新的圖書借閱卡。
2.2.3系統管理功能
1、注冊管理員:為了對圖書館管理系統進行管理,圖書館需要若干名圖書管理員進行管理,在圖書管理員對系統進行管理之前必須進行注冊功能,以確定管理員身份。對管理員進行注冊,系統生成相應信息。其中管理員的基本信息包括:成員ID、密碼等。系統管理員每次登陸前輸入自己的ID與密碼,系統對其信息進行核實,如基本信息正確,則系統管理員可進行系統管理功能,若系統檢查不正確,則系統管理員不可以進行相應的操作。
2、修改密碼:服務圖書館管理員可能由于某些原因,如電腦中毒導致管理員密碼的泄露,為避免圖書管理信息遭到破壞,系統具有修改密碼的功能,確保圖書管理功能的安全性。
3、退出功能:系統管理員每次離開必須進行退出功能,確保管理功能不被他人所用,這樣更方便圖書管理系統出現問題時,找到責任人。
第三章 概要設計
3.1總體設計
3.1.1系統目標設計
系統開發的總目標是實現內部圖書借閱管理的系統化、規范化和自動化。能夠對圖書進行注冊登記,也就是將圖書的基本信息(如:書名、作者、價格等)
預先存入數據庫中,供以后檢索。能夠對借閱人進行注冊登記,包括記錄借閱人的姓名、地址、電話等信息。提供方便的查詢方法。如:以書名、作者、出版社、出版時間(確切的時間、時間段、某一時間之前、某一時間之后)等信息進行圖書檢索,并能反映出圖書的借閱情況;以借閱人編號對借閱人信息進行檢索;以出版社名稱查詢出版社聯系方式信息。提供統計分析功能。可以展現出圖書類型比例、庫存與借出比例。提供舊書銷毀功能,對于淘汰、損壞、丟失的書目可及時對數據庫進行修改。能夠對使用該管理系統的用戶進行管理,按照不同的工作職能提供不同的功能授權。提供較為完善的差錯控制與友好的用戶界面,盡量避免誤操作。3.1.2系統功能分析
根據以上功能,將圖書管理系統的數據分為:數據輸入部分:主要包括圖書基本信息的錄入、借閱人基本信息的錄入、用戶基本信息的錄入。數據輸出部分:主要是各種統計查詢,包括:根據圖書信息(如書名、作者、出版社等)查閱圖書及其借閱信息、統計輸出圖書類型比例等。數據處理部分:主要涉及借閱和歸還的處理,如一本書借出后,必須在數據
庫中將該書標記為已借出,以防出現數據庫中有書但圖書館無書的情況;一本書歸還后,同樣必須在數據庫中將其標記為已經歸還,以便再次借出。
概念設計階段主要任務和目標是根據需求分析的結果,包括一般聯系實體,畫出對應的ER圖。對于復雜的系統,通常首先要對它的各功能模進行分析,然后再把它的功能結構圖畫出來,便是設計和優化。功能分析之后,再根據各個崗位、各個用戶對數據和使用權限的不同要求作出局部ER圖,然后再把各個局部ER圖綜合起來形成統一的整體ER圖。
3.2系統設計思想
1、圖書管理系統是典型的信息管理系統(MIS),其開發主要包括后臺數據庫的建立和維護以及前端應用程序的開發兩個方面。圖書管理系統使用的是SQL Server2000的數據管理系統和以Visual Basic6.0為開發工具。
2、首先進行系統設計分析,系統設計主要包括系統功能分析、系統模塊設計以及運行環境的選擇、系統實現過程。
3、然后根據系統功能分析設計出需要的數據庫,繪制系統數據流圖與總結數據字典、設計數據庫結構。
4、最后在實現各個功能模塊時,采用先模塊后系統集成的方式,即各系統功能模塊分別獨立設計和調試,在創建系統主窗體時才將各個功能模塊通過主窗體菜單系統集成到一起,最后進行系統整體的設計和調試。
3.3 系統模塊功能解析
(1)系統設計分析
本圖書管理系統主要有以下功能: 圖書征訂:包括圖書征訂數據的錄入、修改、刪除與審校等功能。圖書編目:包括圖書數目信息的錄入、修改、刪除功能。圖書典藏:包括新書分配、庫室調配等功能。
圖書流通:包括圖書借閱、續借、圖書返還,圖書書目的查詢的功能。系統用戶管理:包括系統用戶數據的錄入、修改與刪除等功能。
讀者數據管理:包括讀者類別管理,讀者個人數據的錄入、修改和刪除功能。(2)系統功能分析
權限功能:權限功能設置的對象為高級管理員、普通管理員、讀者。高級管 刪除所有信息;普通管理員只能對授權范圍內進行相應修改及刪除;讀者 只能查詢借閱記錄和圖書書目不能修改。
錄入功能:為普通管理員提供相應的錄入功能,為高級管理員提供對所有信息的錄入功能。
查詢功能:為所有用戶提供查詢的功能,可查詢允許范圍內的所有信息。維護功能:為普通管理員提供查詢及相應的修改,刪除功能,為高級管理提 供對所有信息的修改刪除功能。
打印功能:可打印圖書征訂計劃。
退出功能:各個功能模塊和主窗體都設有關閉命令按鈕,可方便地退出各模 塊或系統。
第四章 詳細設計
4.1程序設計說明
4.1.1用戶登錄模塊
1.程序描述:此程序用于用戶登陸的至用戶界面,程序通過輸入用戶的ID,用戶密碼的正確性來實現對驗證用戶的真實性。2.功能:實現用戶的登錄功能
3.性能:用戶通過輸入用戶ID,用戶名和密碼進行用戶登陸,通過認證后,用戶
即可進入用戶界面。
4.輸入項:輸入用戶ID,用戶名,密碼5.輸出項:用戶主頁面。流程邏輯如圖所示:
輸入用戶名和密碼N數據庫是否打開Y連接失敗返回N用戶名和密碼是否正確Y輸入次數是否超過5次YN重新輸入密碼關閉數據庫返回登陸成功進入主界面
圖4-1用戶登錄流程邏輯
4.1.2用戶添加模塊
1.程序描述:此程序用于添加新的用戶,用戶通過向數據庫內輸入必要的信息來注冊成為新的用戶,才通過一系列的驗證之后,即注冊成為真正的用戶。
2.功能:實現對用戶的添加功能。
3.性能:查詢新用戶的用戶名是否存在,若存在則停止添加返還數據庫;若用戶不存在,則進行添加,并進行注冊,注冊成功后返回。
4.輸入項:輸入用戶的詳細信息,包括姓名,出生日期,性別,地址,身份證號碼,電話號碼等信息。
5.輸出項:若添加成功,則輸出提示用戶注冊成功界面;若未成功,則提示輸出未成功原因界面。
6.流程邏輯如下圖所示:
輸入用戶信息N判斷數據庫是否打開提示連接失敗返回Y查詢數據庫中是否有該用戶Y提示已經存在該用戶關閉數據庫并返回N向數據庫中添加新用戶提示注冊成功返回
圖4-2用戶添加模塊流程邏輯
4.1.3書籍查詢模塊
1.程序描述:此程序用于實現用戶對想要借閱的查詢功能。用戶通過輸入相應的圖書信息來查詢,數據庫根據用戶提供的信息來搜索,最后給出客戶相應的圖書信息。
2.功能:實現圖書查詢功能。
3.性能:對進行想要查詢的書籍進行搜索,若存在此書則顯示該書的詳細信息;若不存在此書,則提示沒有此書并返回。
4.輸入項:輸入圖書的詳細信息,包括圖書名稱,書籍ID,圖書作者,出版社,單價等信息。
5.輸出項:若輸入的圖書存在即輸出圖書詳細信息界面;若輸入的圖書不存在則顯示圖書不存在界面。
6.流程邏輯如下圖所示:
輸入圖書信息判斷數據庫是否打開Y查詢是否有該書YN連接失敗返回N關閉數據庫返回顯示該書的信息關閉數據庫返回 圖4-3圖書查詢模塊流程
4.1.4圖書借閱模塊
1.程序描述:此程序用于圖書的借閱,用戶通過登錄自己的借閱ID后,對需要借閱的圖書進行借閱操作,如果符合借閱的要求,則可進行借閱。2.功能:實現對圖書的書籍借閱功能。
3.性能:首先驗證借閱者輸入的借閱ID是否存在,若存在進行下一步;若不存在則返回。
4.若借閱ID存在,則檢查此借閱ID是否借閱書籍超出4本,若超出則提示超出借閱數目,返回;若沒有超出,則進行下一操作。
5.對想要借閱的圖書ID進行搜索,若此書不存在,則提示此書不存在;若此書存在則進行下一步操作。
將借閱者借閱的數量増一,將數據庫中此書數量減一,同時提醒借閱成功,然后返回。
6.輸入項:輸入借閱證的ID,圖書ID 7.輸出項:若借閱證ID正確且圖書ID正確且符合借閱要求,則輸出提示借閱成功界面;若存在借閱ID或圖書ID或不符合借閱要求等問題,則輸出提示沒有借閱成功原因的界面。8.流程邏輯如下圖
輸入書籍ID和借閱IDN數據庫是否打開YN借閱卡ID是否存在YY判斷借閱ID是否借書超出4本提示超出最大借書數量關閉數據庫返回提示不存在該借閱者關閉數據庫返回數據庫連接失敗返回NN數據庫中是否存在書籍IDY將借閱者的借書數量加1提示不存在該書籍關閉數據庫返回將書籍的數量減1提示借書成功關閉數據庫返回 圖4-4圖書借閱模塊
4.1.5圖書歸還模塊
1.程序描述:此程序用于圖書的歸還,用戶在登錄自己的ID之后,用戶可以對需要歸還的圖書進行操作,如果符合歸還要求,則可以將圖書歸還。2.功能:實現對圖書的書籍歸還功能。
3.性能:首先驗證借閱者輸入的借閱ID是否存在,若存在進行下一步;若不存在則返回。
對想要歸還的圖書ID進行搜索,若此書不存在,則提示此書不存在;若此書存在則進行下一步操作。將借閱者借閱的數量減一,將數據庫中此書數量加一,同時提醒借閱歸還,然后返回。
4.輸入項:輸入借閱證ID和圖書ID 5.輸出項:若借閱證ID和圖書ID正確,則輸出提示圖書歸還成功界面;若借閱證ID或圖書ID不正確,則輸出提示沒有成功原因的界面。
6.流程邏輯如下圖:
輸入書籍ID和借閱IDN數據庫是否打開YN借閱卡ID是否存在YN提示不存在該書籍關閉數據庫返回提示不存在該借閱者關閉數據庫返回數據庫連接失敗返回數據庫中是否存在書籍IDY將借閱者的借書數量減1將書籍的數量加1提示還書成功關閉數據庫返回 圖4-5圖書歸還模塊
4.1.6新書入庫模塊
1.程序描述:此程序用戶對新進圖書的入口登記處理。用戶可以將新書的詳細信息進行輸入,保存在數據庫中后,新書即登記成功。
2.功能;實現新進圖書入庫功能。
3.性能:對數據庫查詢是否已存在此書,若存在則將此書數量加一,提示添加成功;若沒有此書,則將此書的基本信息存入數據庫,并提示添加書籍成功。
4.輸入項:輸入新書的書籍ID,書名,作者,出版社,單價等信息。
5.輸出項:若添加成功,則輸出提示新書添加成功界面;若沒有添加成功,輸出提示未成功原因界面。
6.流程邏輯如下圖
輸入書籍信息N數據庫是否打開關閉數據庫返回Y是否已經存在Y該書將該書的數量加1提示添加書籍成功關閉數據庫N將該書信息存入數據庫是否是第一條N記錄提示添加書籍成功關閉數據庫返回Y提示添加第一本書籍關閉數據庫返回圖4-6新書入庫模塊
返回
第五章 編碼與測試
5.1各功能模塊的實現
(1)用戶登錄窗體
圖5-1 用戶登錄窗體
用戶登錄代碼:
Const MaxLogTimes As Integer = 3 Private Sub cmdcancel_Click()
If MsgBox(“是否真的退出系統登錄?”, vbYesNo, “登錄驗證”)= vbYes Then
Unload Me
End If End Sub Private Sub cmdok_Click()
Static intLogTimes As Integer
intLogTimes = intLogTimes + 1
If intLogTimes > MaxLogTimes Then
MsgBox “超過登錄次數!”, vbCritical, “登錄驗證”
Else
With Library_Manage.rsSysUsers
.Open
If.RecordCount > 0 Then
.MoveFirst
.Find “編號=” & Trim(txtLog(0))& “"
If.EOF Then
MsgBox Trim(txtLog(0))& ”不是系統用戶,請檢查輸入!“, vbCritical, ”登錄驗證“
txtLog(0).SetFocus
txtLog(0).SelStart = 0
txtLog(0).SelLength = Len(txtLog(0))
ElseIf.Fields(”口令“)<> Trim(txtLog(1))Then
MsgBox ”口令錯誤,請檢查輸入口令!“, vbCritical, ”登錄驗證“
txtLog(1).SetFocus: txtLog(1)= ”“
Else
CurrentUserNum =.Fields(編號)
CurrentUserPassword =.Fields(”口令“)
CurrentUserStatus =.Fields(”權限“)
MsgBox ”歡迎使用常州信息學院管理系統!“, vbInformation, ”登陸成功!“
Unload Me
End If
End If
.Close
End With
End If End Sub Private Sub Form_Load()
SysLogon.BackColor = RGB(192, 210, 270)End Sub(2)用戶管理窗體界面
圖5-2 用戶管理窗體
用戶管理窗體代碼 '保存
Private Sub cmdSave_Click()
Dim objcopy As New Recordset
If Trim(txtNum)= ”“ Then
MsgBox ”不能為空!“, vbCritical, ”系統用戶管理“
txtNum.SetFocus
txtNum.SelStart = 0
txtNum.SelLength = Len(txtNum)
ElseIf Len(Trim(txtPwd))<> 6 Then
MsgBox ”用戶口令須為6位字符串!“, vbCritical, ”系統用戶管理“
txtPwd.SetFocus
txtPwd.SelStart = 0
txtPwd.SelLength = Len(txtPwd)ElseIf Not txtAuth Like ”[0,1]“ Then
MsgBox ”用戶權限必須為0或1“, vbCritical, ”系統用戶管理“
txtAuth = ”“
txtAuth.SetFocus Else
Set objcopy = Library_Manage.rsSysUsers.Clone '對錯?
With objcopy
If.RecordCount > 0 Then
.MoveFirst
.Find ”編號“ & Trim(txtNum)& ”“
If Not.EOF And.AbsolutePosition <> Library_Manage.rsSysUsers.AbsolutePosition Then
MsgBox ”編號:“ & Trim(txtNum)& ”已被使用,請選擇其他編號!“, vbCritical, ”系統用戶管理“
txtNum.SetFocus
txtNum.SelStart = 0
txtNum.SelLength = Len(txtNum)
Exit Sub
Else
'保存記錄
Library_Manage.rsSysUsers.Update
MsgBox ”數據保存成功!“, vbInformation, ”系統用戶管理“
cmdAdd.Enabled = True
cmdDel.Enabled = True
isAdding = False: picNavigation.Enabled = True
End If
End With End If End Sub Private Sub Form_Load()
cmdMove(0).Value = True End Sub(3)讀者數據管理窗體界面
圖5-3 讀者數據管理窗體
讀者數據管理窗體代碼
Library_Manage.Library_Manage_Con.Execute ”TRUNCATE TABLE 讀者類別“
With Library_Manage.ReaderType
If.State = adStateClosed Then.Open
.AddNew
.Fields(”編號“)= ”0“
.Fields(”名稱“)= ”特殊“
.Fields(”借書量“)= Val(txtSp(1))
.Fields(”借書期“)= Val(txtSp(2))
.Fields(”有效期“)= Val(txtSp(3))
.Update
.AddNew
.Fields(”編號“)= ”1“
.Fields(”名稱“)= ”館員“
.Fields(”借書量“)= Val(txtL(1))
.Fields(”借書期“)= Val(txtL(2))
.Fields(”有效期“)= Val(txtL(3))
.Update
.AddNew
.Update
.AddNew
.Fields(”編號“)= ”2“
.Fields(”名稱“)= ”教師“
.Fields(”借書量“)= Val(txtT(1))
.Fields(”借書期“)= Val(txtT(2))
.Fields(”有效期“)= Val(txtT(3))
.Update
.AddNew
.Fields(”編號“)= ”3“
.Fields(”名稱“)= ”學生“
.Fields(”借書量“)= Val(txtS(1))
.Fields(”借書期“)= Val(txtS(2))
.Fields(”有效期“)= Val(txtS(3))
.Update
End With End Sub Private Sub Form_Load()cmdMove(0).Value = True End Sub Private Sub SSTab1_DblClick()End Sub(4)圖書征訂管理窗體
圖5-4 圖書征訂管理窗體
圖書征訂管理代碼
txtPubDate.SelLength = Len(txtPubDate)
ElseIf Trim(txtAuthor)= ”“ Then
MsgBox ”作者不能為空!“, vbCritical, ”圖書征訂管理“
txtAuthor.SetFocus
txtAuthor.SelStart = 0
txtAuthor.SelLength = Len(txtAuthor)
ElseIf Val(txtNum)= ”“ Then
MsgBox ”正的數量無效!“, vbCritical, ”圖書征訂管理“
txtNum.SetFocus
txtNum.SelStart = 0
txtNum.SelLength = Len(txtNum)
ElseIf Not IsDate(txtDate)= ”“ Then
MsgBox ”作者不能為空!“, vbCritical, ”圖書征訂管理“
txtDate.SetFocus
txtDate.SelStart = 0
txtDate.SelLength = Len(txtDate)
Else
'保存記錄
Library_Manage.rsBooksOrder.Update
MsgBox ”數據保存成功!“, vbInformation, ”圖書征訂管理“
cmdAdd.Enabled = True: cmdDel.Enabled = True
cmdExam.Enabled = True: cmdRefresh.Enabled = True
isAdding = False: picNavigation.Enabled = True
End If End Sub Dim objcopy As Recordset Private Sub cmbOut_Click()
AddListOut
End Sub Private Sub cmdAddAll_Click(Index As Integer)'選擇全部條碼
ListItem_Add lstPre(Index), LstIn(Index), Index, True End Sub Private Sub cmdAddOne_Click(Index As Integer)'選擇當前條碼
ListItem_Add lstPre(Index), LstIn(Index), Index, False End Sub Private Sub cmdExit_Click()
If LstIn(0).ListCount > 0 Then
If MsgBox(”你選定了部分新書準備入庫,但沒執行保存操作“ & vbCr & ”是否要執行保存操作?“, vbCritical + vbYesNo, ”圖書典藏管理“)= vbYes Then
SSTab1.Tab = 0
cmdSave.Value = True
End If
ElseIf LstIn(1).ListCount > 0 Then
If MsgBox(”你選定了部分新書準備入庫,但沒執行保存操作“ & vbCr & ”是否要執行保存操作?“, vbCritical + vbYesNo, ”圖書典藏管理“)= vbYes Then
SSTab1.Tab = 1
cmdSave.Value = True
End If
End If
Unload Me End Sub '刷新新書或調出庫室條碼列表
Private Sub cmdRefresh_Click(Index As Integer)
Select Case Index
Case 0 '刷新新書列表
With Library_Manage.rsBooksBibli
If.State = adStateClosed Then.Open
.Requery
End With
AddListNew
Case 1 '刷新庫室條碼列表
With Library_Manage.rsBooksStore
If.State = adStateClosed Then.Open
.Requery
End With
AddListOut
End Select End Sub Public Sub AddListNew()
lstPre(0).Clear
With Library_Manage.rsBooksBibli
If.State = adStateClosed Then.Open
If.RecordCount > 0 Then
.MoveFirst
While Not.EOF
lstPre(0).AddItem.Fields(”條碼“)
.MoveNext
Wend
Else
lstPre(0).AddItem ”當前無待分配新書"
End If End With End Sub 5.2 測試
5.2.1 借閱卡管理測試
進度安排測試辦理借閱證信息,檢查個人賬號、讀者可自行修改密碼。測試查詢借閱卡信息的正確性,包括輸入的讀者信息等。測試借閱卡掛失功能,包括讀者信息等。
5.2.2 書籍管理測試
進度安排:測試新書入庫信息的正確性。測試借書、還書功能信息正確性。測試書籍掛失信息的正確性。測試圖書信息查詢的正確性。測試借書信息查詢的正確性。
5.2.3 系統管理測試
進度安排測試注冊管理員信息的正確性。測試修改密碼信息的正確性。
結束語
對于這篇論文我有不少心得體會。這次是對我們掌握所學知識的一次考核。它可以讓我們了解自己一學期里的學習情況,有助于在今后的學習中加以改進。通過這次上機實驗,我發現了自己對數據庫和vb語言掌握的并不牢,有的知識點根本就不懂。這都要怪自己在平時的學習過程中不夠用心,不懂的地方也沒有及時的去搞懂,課后也沒怎么花時間去研究。這次實驗我覺得自己不僅學到了很多軟件設計方面的知識,也讓我鞏固了以前所學的知識以及看到了自己以前學習中的不足之處。
在今后的學習過程中,我一定會認真學習專業課程,再也不能像以前那樣迷迷糊糊的,課后要多花時間去研究一些有關編程方面的題目,不懂的地方及時把它弄懂。以后自己還要多動手編寫一些程序。在這里我要感謝學校能提供這么一個寶貴的機會,我們可以把課堂上所學的理論知識運用到實踐中去,把書上的東西變成我們自己的。這個機會既讓我們學習鞏固了知識,也讓我們發現了自己的不足之處。特別要感謝我們的指導老師,正因為有了您的幫助我們才可以完成實驗。我也希望今后還會有更多的機會讓我們去實踐,去充實自己。
致 謝
在本次設計的過程中,老師們給了我們很大的幫助。不僅使我們在規定時間內完成了系統的設計,同時還使我們學到了很多有益的知識和寶貴的經驗在此,我謹向他們表示最衷心的感謝。感謝老師的指導,使我們充分利用軟件工程,VB,數據庫原理開發出自己的項目.在開發的過程中使我體會到了工程化開發方法和瀑布模型利用的重要性,在此還要感謝所有合作參與項目開發的同學們這次畢業設計的成功離不開所有參與的同學們的幫助和支持,是他們讓我知道了團隊工作的重要.參考文獻
1、陶宏才.數據庫原理及設計[M].北京:清華大學出版社.2004.2、陸麗娜.軟件工程 [M].北京:經濟科學出版社.1999
3、郝志恒、劉舫.Visual Basic 6.0 編程篇[M] 北京:電子工業出版社 2004
4、劉世峰.數據庫基礎與應用[M] 北京: 中央電大出版社 2003
5、吳斌、魯大林.Visual Basic+SQL Sever數據庫應用系統開發[M] 北京:機械工程出版社 2008
6、邱李華.SQL Server 2000 數據庫應用教程[M] 北京:人民郵電出版社 2007
7、鐘軍.Visual Basic數據庫高級實例導航[M] 北京:清華大學出版社 2003
8、趙松濤.Visual Basic+SQL Server 2000 系統開發實錄[M] 北京: 機械工業出版社 2007