图书管理系统ER图-流程图-功能结构图-源代码 第14页

图书管理系统ER图-流程图-功能结构图-源代码 第14页

If Check5.Value = vbChecked Then

   If Trim(sql) = "" Then

      sql = "书籍编号='" & Trim(Text4.Text & " ") & "'"

   Else

      sql = sql & "and  书籍编号='" & Trim(Text4.Text & " ") & "'"

   End If

End If

If Trim(sql) = "" Then

   MsgBox "请选择查询方式!", vbOKOnly + vbExclamation

   Exit Sub

End If

sql = "select * from 书籍信息 where " & sql

rs_findbook.CursorLocation = adUseClient

rs_findbook.Open sql, conn, adOpenKeyset, adLockPessimistic

DataGrid1.AllowAddNew = False

DataGrid1.AllowDelete = False

DataGrid1.AllowUpdate = False

Set DataGrid1.DataSource = rs_findbook

'rs_findbook.Close

End Sub

Private Sub Command2_Click()

Unload Me

End Sub

Private Sub Command3_Click()

If Trim(book_num) = "" Then

   MsgBox "请选择要借阅的图书!", vbOKOnly + vbExclamation

   Exit Sub

End If

If panduan = "" Then

   MsgBox "此书已被借出!", vbOKOnly + vbExclamation

   Exit Sub

End If

frmborrowbook.Show

End Sub

Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)

book_num = DataGrid1.Columns(0).CellValue(DataGrid1.Bookmark)

panduan = DataGrid1.Columns(7).CellValue(DataGrid1.Bookmark)

End Sub

Private Sub Form_Load()

Dim rs_find As New ADODB.Recordset

Dim sql As String

sql = "select * from 图书类别"

rs_find.Open sql, conn, adOpenKeyset, adLockPessimistic

rs_find.MoveFirst

If Not rs_find.EOF Then

   Do While Not rs_find.EOF

      Combo1.AddItem rs_find.Fields(0)

      rs_find.MoveNext

   Loop

   Combo1.ListIndex = 0

End If

rs_find.Close

End Sub

7、文件名 frmaddreaderstylefrmaddreaderstyle.frm

功能说明:添加读者的类别。

源代码:

Option Explicit

Dim rs_readerstyle As New ADODB.Recordset

Private Sub Command1_Click()

Dim sql As String

If Trim(Text1.Text) = "" Then

   MsgBox "读者种类不能为空", vbOKOnly + vbExclamation, ""

   Text1.SetFocus

   Exit Sub

End If

If Trim(Text2.Text) = "" Then

   MsgBox "借书数量不能为空", vbOKOnly + vbExclamation, ""

   Text2.SetFocus

   Exit Sub

End If

If Trim(Text3.Text) = "" Then

   MsgBox "借书期限不能为空", vbOKOnly + vbExclamation, ""

   Text3.SetFocus

   Exit Sub

End If

If Trim(Text4.Text) = "" Then

   MsgBox "有限期限不能为空", vbOKOnly + vbExclamation, ""

   Text4.SetFocus

   Exit Sub

End If

sql = "select * from 读者类别 where 种类名称='" & Text1.Text & "'"

rs_readerstyle.Open sql, conn, adOpenKeyset, adLockPessimistic

If rs_readerstyle.EOF Then

   rs_readerstyle.AddNew

   rs_readerstyle.Fields(0) = Trim(Text1.Text)

   rs_readerstyle.Fields(1) = CInt(Text2.Text)

   rs_readerstyle.Fields(2) = CInt(Text3.Text)

   rs_readerstyle.Fields(3) = CInt(Text4.Text)

   rs_readerstyle.Update

   MsgBox "添加读者类别成功!", vbOKOnly, ""

   rs_readerstyle.Close

   Text1 = ""

   Text2 = ""

   Text3 = ""

   Text4 = ""

Else

   MsgBox "读者类别重复!", vbOKOnly + vbExclamation, ""

   Text1.SetFocus

   Text1.Text = ""

   rs_readerstyle.Close

   Exit Sub

End If

End Sub

8、文件名 frmmodifyreaderstyleform

功能说明:读者类别管理,可以查询、删除、修改读者的信息。

源代码:

Option Explicit

Dim rs_reader As New ADODB.Recordset

   cmdmodify.Enabled = True

   cmddel.Enabled = True

 << 上一页  [11] [12] [13] [14] [15] [16] [17] [18] 下一页

  • 上一篇文章:
  • 下一篇文章:
  • Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有