vb图书管理系统源代码_第1页
vb图书管理系统源代码_第2页
vb图书管理系统源代码_第3页
vb图书管理系统源代码_第4页
vb图书管理系统源代码_第5页
已阅读5页,还剩31页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

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 已借书数 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 If End Sub Private 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 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 Fields 作者 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 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 recs 1 Call encomm End If End Sub Private Sub Comm4 Click Unload Me 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 book where str Adodc1 Refresh Else Adodc1 RecordSource select from book Adodc1 Refresh End If recs Adodc1 Recordset RecordCount If recs 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 recs 0 Then Comm2 Enabled False Comm3 Enabled False Else Comm2 Enabled True Comm3 Enabled True End If End Sub Private Sub Text1 KeyPress Index As Integer KeyAscii As Integer Call endata KeyAscii End Sub Edbook1 Dim rs As ADODB Recordset Private Sub Form Load If flag 2 Then 修改操作 Text1 0 Text edbook Adodc1 Recordset Fields 图书编号 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 UID sa PWD conn Open

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论