📄 学习.frm
字号:
VERSION 5.00
Begin VB.Form Libads
Caption = "Form2"
ClientHeight = 4425
ClientLeft = 165
ClientTop = 855
ClientWidth = 7170
LinkTopic = "Form2"
ScaleHeight = 4425
ScaleWidth = 7170
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "退出"
Height = 735
Left = 3840
TabIndex = 3
Top = 2160
Width = 1935
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 735
Left = 1080
TabIndex = 2
Top = 2160
Width = 2055
End
Begin VB.TextBox Text2
Height = 735
Left = 3360
TabIndex = 1
Top = 960
Width = 2175
End
Begin VB.TextBox Text1
Height = 735
Left = 960
TabIndex = 0
Top = 960
Width = 2055
End
Begin VB.Label 借书
Caption = "图书馆借书系统"
Height = 615
Left = 960
TabIndex = 4
Top = 120
Width = 4455
End
Begin VB.Menu QUERY
Caption = "图书查询"
End
Begin VB.Menu COUNT
Caption = "统计借书情况"
End
Begin VB.Menu SET
Caption = "管理员设置"
End
End
Attribute VB_Name = "Libads"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim ADORS1 As New ADODB.Recordset
Dim ADORS2 As New ADODB.Recordset
Private Sub Command1_Click()
Dim STR1 As String '要执行的SQL语句
Dim STR2 As String
STR1 = Text1.Text
STR2 = Text2.Text
r = 1
If Not ADORS1.BOF Then
ADORS1.MoveFirst
While Not ADORS1.EOF And r = 1
If Trim(ADORS1.Fields("door_no").Value) = Trim(Text1.Text) Then
r = 0
Else
ADORS1.MoveNext
End If
Wend
If r = 1 Then
MsgBox "无此用户"
Exit Sub
End If
Else
MsgBox "无此用户"
Exit Sub
End If
r = 1
If Not ADORS2.BOF Then
ADORS2.MoveFirst
While Not ADORS2.EOF And r = 1
If Trim(ADORS2.Fields("isbn").Value) = Trim(Text2.Text) Then
r = 0
Else
ADORS2.MoveNext
End If
Wend
If r = 1 Then
MsgBox "无此书"
Exit Sub
End If
Else
MsgBox "无此书"
Exit Sub
End If
With adoRs
.ActiveConnection = Nothing
.AddNew
.Fields("door_no") = Text1.Text
.Fields("isbn") = Text2.Text
.Fields("return_books") = "60"
.ActiveConnection = Aconnection
.Update
End With
MsgBox "借书成功"
End Sub
Private Sub Command2_Click()
Bianmu.Show
End Sub
Private Sub Form_Load()
Dim str As String
Dim STR1 As String '要执行的SQL语句
Dim STR2 As String
STR1 = "select door_no from student_books "
ADORS1.Open STR1, Aconnection, adOpenKeyset, adLockOptimistic
STR2 = "select isbn from library_books "
ADORS2.Open STR2, Aconnection, adOpenKeyset, adLockOptimistic
str = "select * from borrower_books"
ExecSql (str)
End Sub
Private Sub SET_Click()
Form1.Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -