Private Sub Form_Unload(Cancel As Integer)
Set DataGrid1.DataSource = Nothing
rs_reader.Close
End Sub
11、文件名 frmfindreader(frmfindreader.frm)
功能说明:查询读者信息,可以选择性的输入读者姓名、读者编号、读者种类来查询读者的详细信息。
源代码:
Option Explicit
Private Sub Command1_Click()
Dim rs_findreader As New ADODB.Recordset
Dim sql As String
If Check1.Value = vbChecked Then
sql = "读者编号='" & Trim(Text1.Text & " ") & "'"
End If
If Check2.Value = vbChecked Then
If Trim(sql) = "" Then
sql = "读者姓名='" & Trim(Text2.Text & " ") & "'"
Else
sql = sql & "and 读者姓名='" & Trim(Text2.Text & " ") & "'"
End If
End If
If Check3.Value = vbChecked Then
If Trim(sql) = "" Then
sql = "读者类别='" & Trim(Combo1.Text & " ") & "'"
Else
sql = sql & "and 读者类别='" & Trim(Combo1.Text & " ") & "'"
End If
End If
sql = "select * from 读者信息 where " & sql
rs_findreader.CursorLocation = adUseClient
rs_findreader.Open sql, conn, adOpenKeyset, adLockPessimistic
DataGrid1.AllowAddNew = False
DataGrid1.AllowDelete = False
DataGrid1.AllowUpdate = False
Set DataGrid1.DataSource = rs_findreader
End Sub
Private Sub Command2_Click()
Unload Me
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
If Not rs_find.EOF Then
Do While Not rs_find.EOF
Combo1.AddItem rs_find.Fields(0)
rs_find.MoveNext
Combo1.ListIndex = 0
End If
rs_find.Close
End Sub
12、文件名 frmfindborrowinfo(frmfindborrowinfo.frm)
功能说明:查询借书信息,可以查询到已借出的书、未借出的图书。
源代码:
Option Explicit
Private Sub Command1_Click()
Dim sql As String
Dim rs_find As New ADODB.Recordset
If Option1.Value = True Then
sql = "select * from 书籍信息 where 是否被借出='是'"
End If
If Option2.Value = True Then
sql = "select * from 书籍信息 where 是否被借出='否'"
End If
If Option3.Value = True Then
sql = "select * from 借阅信息 where 读者姓名='" & Text1.Text & "'"
End If
rs_find.CursorLocation = adUseClient
rs_find.Open sql, conn, adOpenKeyset, adLockPessimistic
DataGrid1.AllowAddNew = False
DataGrid1.AllowDelete = False
DataGrid1.AllowUpdate = False
Set DataGrid1.DataSource = rs_find
End Sub
13、文件名 frmbackbookinfo(frmbackbookinfo.frm)
功能说明:添加还书信息,可以通过读者编号、读者姓名、图书编号、图书名称等查询到已借出的书。
源代码:
Option Explicit
Dim findform As Boolean
Private Sub Combo1_Click()
Combo2.ListIndex = Combo1.ListIndex
End Sub
Private Sub Command1_Click()
Dim rs_reader As New ADODB.Recordset
Dim sql As String
findform = True
sql = "select * from 借阅信息 where 读者姓名='" & Combo2.Text & "'"
rs_reader.CursorLocation = adUseClient
rs_reader.Open sql, conn, adOpenKeyset, adLockPessimistic
Set DataGrid1.DataSource = rs_reader
DataGrid1.AllowAddNew = False
DataGrid1.AllowDelete = False
DataGrid1.AllowUpdate = False
End Sub
Private Sub Command2_Click()
Dim rs_book As New ADODB.Recordset
Dim sql As String
findform = False
sql = "select * from 借阅信息 where 书籍编号='" & Combo3.Text & "'"
rs_book.CursorLocation = adUseClient
rs_book.Open sql, conn, adOpenKeyset, adLockPessimistic
Set DataGrid1.DataSource = rs_book
DataGrid1.AllowAddNew = False
DataGrid1.AllowDelete = False
DataGrid1.AllowUpdate = False
End Sub
Private Sub Command3_Click()
Dim book_num As String
Dim reader_num As String
Dim answer As String
Dim rs_back As New ADODB.Recordset
<< 上一页 [11] [12] [13] [14] [15] [16] [17] [18] 下一页