最新vb图书管理系统源代码.doc
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《最新vb图书管理系统源代码.doc》由会员分享,可在线阅读,更多相关《最新vb图书管理系统源代码.doc(178页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、Four short words sum up what has lifted most successful individuals above the crowd: a little bit more.-author-datevb图书管理系统源代码vb图书管理系统源代码Borbook:Public sqltxt As StringPublic rno As String 保存读者借书证号Public bno As String 保存读者图书编号Public xm As String 保存读者姓名Public dw As String 保存读者单位Public rs As ADODB.Rec
2、ordsetPrivate 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 Te
3、xt2(0).Text = rs.Fields(姓名) Text2(1).Text = str(rs.Fields(借书总数) Text2(2).Text = str(rs.Fields(借书总数) - rs.Fields(已借书数) If Val(Trim(Text2(2).Text) 0 Then xm = rs.Fields(姓名) dw = rs.Fields(单位) Comm2.Enabled = True Else MsgBox 该读者已借满图书,不能再借!, vbOKOnly, 信息提示 Comm2.Enabled = False End If End If End IfEnd
4、SubPrivate Sub Comm2_Click() If Val(Trim(Text2(2).Text) = 0 Then MsgBox 该读者已借满图书,不能再借!, vbOKOnly, 信息提示 Comm2.Enabled = False Exit Sub End If bno = Trim(Text1(1).Text) If bno = Then MsgBox 图书编号不能为空,请输入, vbOKOnly, 信息提示 Comm2.Enabled = False Else sqltxt = select * from book where 图书编号= + bno + Set bs =
5、 exesql(sqltxt) If bs.RecordCount = 0 Then MsgBox 图书编号不正确,请重新输入, vbOKOnly, 信息提示 Else If bs.Fields(借否) = 借 Then MsgBox 该图书编号对应的图书已借出,不能再借!, vbOKOnly, 信息提示 Else sqltxt = select * from borrow Set brs = exesql(sqltxt) brs.AddNew brs.Fields(图书编号) = bno brs.Fields(书名) = bs.Fields(书名) brs.Fields(作者) = bs.F
6、ields(作者) brs.Fields(出版社) = bs.Fields(出版社) brs.Fields(借书证号) = rno brs.Fields(姓名) = xm brs.Fields(单位) = dw brs.Fields(借书日期) = Date brs.Update bs.Fields(借否) = 借 bs.Update rs.Fields(已借书数) = rs.Fields(已借书数) + 1 rs.Update Text2(2).Text = str(rs.Fields(借书总数) - rs.Fields(已借书数) End If End If End IfEnd SubPr
7、ivate Sub retCom_Click() Unload MeEnd SubPrivate Sub Form_Load() Comm2.Enabled = FalseEnd SubEdbook:Private Sub DataGrid1_Click()End SubPrivate Sub Form_Load() 说明:为什么使用recs,而不直接使用adodc1.recordset.recordcount?在调用edbook1窗体添加一个记录(确定)后,再 返回到本表单,若不在Form_Activate()事件过程中调用adodc1.refresh进行刷新,adodc1.recordse
8、t.recordcount值 仍未增1,这样调用encomm过程时出错;若在Form_Activate()事件过程中调用adodc1.refresh进行刷新, adodc1.recordset.recordcount值增1了,调用encomm过程时也正确,但返回本窗体时,当前行总是第一行,显然也不行, 因为用户在添加或修改后希望在datagrid1中显示当前操作的那条记录. recs = Adodc1.Recordset.RecordCountEnd SubPrivate Sub Form_Activate() DataGrid1.SetFocus Call encommEnd SubPriv
9、ate Sub Comm1_Click() flag = 1 edbook1.Show vbModalEnd SubPrivate Sub Comm2_Click() flag = 2 edbook1.Show vbModalEnd SubPrivate Sub Comm3_Click() If MsgBox(真的要删除 + Trim(Adodc1.Recordset.Fields(书名) + 吗?, vbYesNo, 信息提示) = vbYes Then Adodc1.Recordset.Delete recs = recs - 1 Call encomm End IfEnd SubPriv
10、ate Sub Comm4_Click() Unload MeEnd SubPrivate 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
11、(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) + Els
12、e 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 book where + str Adodc1.Refresh Else Adodc1.RecordSo
13、urce = select * from book Adodc1.Refresh End If recs = Adodc1.Recordset.RecordCount If recs = 0 Then MsgBox 没有任何满足条件的记录, vbOKOnly, 信息提示 End If Call encommEnd SubPrivate Sub selcmd2_Click() 重置 Text1(0).Text = Text1(1).Text = Text1(2).Text = Text1(3).Text = Text1(4).Text = End SubPrivate Sub encomm()
14、自定义子过程:判断Adodc1中是否存在记录 If recs = 0 Then Comm2.Enabled = False Comm3.Enabled = False Else Comm2.Enabled = True Comm3.Enabled = True End IfEnd SubPrivate Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer) Call endata(KeyAscii)End SubEdbook1:Dim rs As ADODB.RecordsetPrivate Sub Form_Load() If fl
15、ag = 2 Then 修改操作 Text1(0).Text = edbook.Adodc1.Recordset.Fields(图书编号) & Text1(1).Text = edbook.Adodc1.Recordset.Fields(分类号) & Text1(2).Text = edbook.Adodc1.Recordset.Fields(书名) & Text1(3).Text = edbook.Adodc1.Recordset.Fields(作者) & DataCombo1.Text = edbook.Adodc1.Recordset.Fields(出版社) & Text1(4).Tex
16、t = edbook.Adodc1.Recordset.Fields(定价) & Text1(5).Text = edbook.Adodc1.Recordset.Fields(入库日期) & Text1(0).Enabled = False Else 添加操作 Text1(5).Text = Date End IfEnd SubPrivate Sub Form_Activate() Adodc1.Refresh 数据源刷新End SubPrivate Sub Comm1_Click() If Trim(Text1(0).Text) = Or Trim(Text1(2).Text) = Or T
17、rim(Text1(3).Text) = Or Trim(Text1(5).Text) = Then MsgBox 加*数据项不能为空,请重新设置, vbOKOnly, 信息提示 Exit Sub End If If flag = 1 Then 添加操作 sqltxt = select * from book where 图书编号= + Trim(Text1(0).Text) + 对book中记录进行判断 Set rs = exesql(sqltxt) If rs.RecordCount 0 Then MsgBox 存在相同的图书编号, vbOKOnly, 信息提示 Text1(0).SetF
18、ocus rs.Close Exit Sub Else rs.Close End If edbook.Adodc1.Recordset.AddNew edbook.Adodc1.Recordset.Fields(图书编号) = Trim(Text1(0).Text) edbook.Adodc1.Recordset.Fields(分类号) = Trim(Text1(1).Text) edbook.Adodc1.Recordset.Fields(书名) = Trim(Text1(2).Text) edbook.Adodc1.Recordset.Fields(作者) = Trim(Text1(3).
19、Text) edbook.Adodc1.Recordset.Fields(出版社) = Trim(DataCombo1.Text) edbook.Adodc1.Recordset.Fields(定价) = Val(Trim(Text1(4).Text) edbook.Adodc1.Recordset.Fields(入库日期) = Format(Trim(Text1(5).Text), yyyy-mm-dd) edbook.Adodc1.Recordset.Fields(借否) = 否 edbook.Adodc1.Recordset.Update recs = recs + 1 Else 修改操
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 最新 vb 图书 管理 系统 源代码
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内