第一篇: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