📄 frmdzhsgl.frm
字号:
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=tsgl"
OLEDBString = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=tsgl"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from hsstb"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Frame Frame2
Caption = "归还图书信息"
ForeColor = &H00C00000&
Height = 2520
Left = 140
TabIndex = 7
Top = 960
Width = 6120
Begin VB.TextBox Text9
Height = 300
Left = 1185
TabIndex = 28
Top = 1680
Width = 1815
End
Begin VB.TextBox Text8
Height = 300
Left = 4215
TabIndex = 27
Top = 960
Width = 1815
End
Begin VB.TextBox Text10
Height = 300
Left = 1185
TabIndex = 25
Top = 2040
Width = 1815
End
Begin VB.TextBox Text7
Height = 300
Left = 1185
TabIndex = 22
Top = 960
Width = 1815
End
Begin VB.TextBox Text6
Height = 300
Left = 4215
TabIndex = 21
Top = 600
Width = 1815
End
Begin VB.TextBox Text5
Height = 300
Left = 1185
TabIndex = 20
Top = 600
Width = 1815
End
Begin VB.TextBox Text4
Height = 300
Left = 4215
TabIndex = 19
Top = 240
Width = 1815
End
Begin VB.TextBox Text3
Height = 300
Left = 1200
TabIndex = 18
Top = 240
Width = 1815
End
Begin MSComCtl2.DTPicker DTPicker3
Height = 300
Left = 4215
TabIndex = 5
Top = 1680
Width = 1815
_ExtentX = 3201
_ExtentY = 529
_Version = 393216
Format = 49479681
CurrentDate = 38310
End
Begin MSComCtl2.DTPicker DTPicker2
Height = 300
Left = 4215
TabIndex = 4
Top = 1320
Width = 1815
_ExtentX = 3201
_ExtentY = 529
_Version = 393216
Enabled = 0 'False
Format = 49479681
CurrentDate = 38308
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 300
Left = 1185
TabIndex = 3
Top = 1320
Width = 1815
_ExtentX = 3201
_ExtentY = 529
_Version = 393216
Enabled = 0 'False
Format = 49479681
CurrentDate = 38308
End
Begin VB.Label Label11
Caption = "借书日期:"
ForeColor = &H00800000&
Height = 255
Left = 240
TabIndex = 29
Top = 1320
Width = 900
End
Begin VB.Label Label13
Caption = "实际天数:"
ForeColor = &H00800000&
Height = 255
Left = 255
TabIndex = 24
Top = 1680
Width = 900
End
Begin VB.Label Label12
Caption = "还书日期:"
ForeColor = &H00800000&
Height = 255
Left = 3165
TabIndex = 23
Top = 1320
Width = 1095
End
Begin VB.Label Label8
Caption = "超出天数:"
ForeColor = &H00800000&
Height = 255
Left = 255
TabIndex = 15
Top = 2040
Width = 900
End
Begin VB.Label Label6
Caption = "书籍价格:"
ForeColor = &H00800000&
Height = 255
Left = 255
TabIndex = 14
Top = 600
Width = 900
End
Begin VB.Label Label10
Caption = "实还日期:"
ForeColor = &H00800000&
Height = 255
Left = 3165
TabIndex = 13
Top = 1680
Width = 1095
End
Begin VB.Label Label9
Caption = "规定天数:"
ForeColor = &H00800000&
Height = 255
Left = 3165
TabIndex = 12
Top = 960
Width = 1095
End
Begin VB.Label Label7
Caption = "作 者:"
ForeColor = &H00800000&
Height = 255
Left = 255
TabIndex = 11
Top = 960
Width = 900
End
Begin VB.Label Label5
Caption = "出 版 社:"
ForeColor = &H000000C0&
Height = 255
Left = 3165
TabIndex = 10
Top = 600
Width = 1095
End
Begin VB.Label Label4
Caption = "读者姓名:"
ForeColor = &H000000C0&
Height = 255
Left = 3165
TabIndex = 9
Top = 240
Width = 1095
End
Begin VB.Label Label2
Caption = "书籍名称:"
ForeColor = &H000000C0&
Height = 255
Left = 255
TabIndex = 8
Top = 255
Width = 900
End
End
Begin VB.Frame Frame1
Caption = "读者信息"
ForeColor = &H000000C0&
Height = 720
Left = 120
TabIndex = 1
Top = 120
Width = 6130
Begin VB.TextBox Text2
Height = 300
Left = 1200
TabIndex = 0
Top = 240
Width = 1770
End
Begin VB.TextBox Text1
Enabled = 0 'False
Height = 300
Left = 4200
TabIndex = 2
Top = 285
Width = 1770
End
Begin VB.Label Label3
Caption = "读者编号:"
ForeColor = &H00C000C0&
Height = 255
Left = 240
TabIndex = 16
Top = 360
Width = 1095
End
Begin VB.Label Label1
Caption = "条 码 号:"
ForeColor = &H00C000C0&
Height = 255
Left = 3120
TabIndex = 6
Top = 360
Width = 1095
End
End
End
Attribute VB_Name = "frmdzhsgl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs As ADODB.Recordset
Private Sub Command1_Click()
Dim hs, js, i As String
Dim hs1, sz1 As String
Dim x, y, z As Integer
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "请输入读者编号和条码号", , "提示信息"
Text2.SetFocus
Else
i = MsgBox("确认归还该图书吗!", vbYesNo + vbOKOnly, "提示")
If i = vbYes Then
Set rs = cnn.Execute("insert into hsstb values('" & Text1 & "','" & Text2 & "','" & Text3 & "'," & Text5.Text & ",'" & Text6 & "','" & Text7 & "','" & Text8 & "','" & DTPicker1 & "','" & DTPicker2 & "','" & Text9 & "','" & DTPicker3 & "','" & Text10 & "')")
Adodc1.Refresh
Adodc3.RecordSource = "select * from books where 条码号='" & Text1.Text & "'"
Adodc3.Refresh
If Adodc3.Recordset.RecordCount > 0 Then
Adodc2.RecordSource = "select * from dzjstb where 条码号='" & Text1.Text & "' and 读者编号='" + Text2.Text + "'"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount > 0 Then
x = Val(Adodc3.Recordset.Fields("复本数")) + Val(Adodc2.Recordset.Fields("借书数量"))
y = Val(Adodc3.Recordset.Fields("借书数量")) - Val(Adodc2.Recordset.Fields("借书数量"))
hs1 = "update books set 复本数='" & x & "',借书数量='" & y & "'where 条码号='" & Text1.Text & "'"
cnn.Execute (hs1)
Else
End If
End If
js = "update dzjstb set 借='还',借书数量='0' where 条码号='" & Text1.Text & "'"
cnn.Execute (js)
Adodc2.Refresh
MsgBox "还书成功!", vbOKOnly, "提示"
Else
On Error Resume Next
rs.CancelUpdate
End If
End If
End Sub
'Private Sub Command2_Click()
' Dim i As String
' Dim y As Integer
' Adodc2.RecordSource = "select * from dzjstb where 读者编号='" & Text2.Text & "' and 借='借'"
' On Error Resume Next
' Adodc2.Refresh
' If Adodc2.Recordset.RecordCount > 0 Then
' y = Val(Adodc3.Recordset.Fields("借书数量")) - Val(Adodc2.Recordset.Fields("借书数量"))
' sql = "update books set 复本数='" & 复本数 + 借书数量 & "',借书数量='" & y & "'where 读者编号='" & Text2.Text & "'"
' cnn.Execute (sql)
' End If
' js = "update dzjstb set 借='还',借书数量='0' where 读者编号='" & Text2.Text & "'"
' cnn.Execute (js)
' Adodc2.Refresh
' MsgBox "全部还书成功!", vbOKOnly, "提示"
'End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub DTPicker3_Change()
Text9.Text = DTPicker3.Value - DTPicker1.Value
If DTPicker3.Value <= DTPicker2.Value Then
Text10.Text = 0
Else
Text10.Text = DTPicker3.Value - DTPicker2.Value
End If
End Sub
Private Sub Form_Load()
Set rs = New ADODB.Recordset
rs.Open "select * from hsstb", cnn, adOpenStatic, adLockOptimistic
Me.Caption = Me.Caption & " " & frmmain.StatusBar1.Panels(2).Text
Adodc2.RecordSource = "select * from dzjstb where 借='还'"
Adodc2.Refresh
DTPicker3.Value = Date
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text3.SetFocus
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
If Text2.Text = "" Then
MsgBox "输入不能为空!", , "信息提示"
Else
Text1.Enabled = True
Text1.SetFocus
End If
Else
End If
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text4.SetFocus
End Sub
Private Sub Text1_LostFocus()
Adodc2.RecordSource = "select * from dzjstb where 条码号='" & Text1.Text & "'and 读者编号='" + Text2.Text + "' and 借='借'"
On Error Resume Next
Adodc2.Refresh
If Adodc2.Recordset.RecordCount > 0 Then
Text2.Text = Adodc2.Recordset.Fields(0)
Text3.Text = Adodc2.Recordset.Fields(3)
Text4.Text = Adodc2.Recordset.Fields(1)
Text5.Text = Adodc2.Recordset.Fields(4)
Text6.Text = Adodc2.Recordset.Fields(6)
Text7.Text = Adodc2.Recordset.Fields(7)
Text8.Text = Adodc2.Recordset.Fields(5)
DTPicker1.Value = Adodc2.Recordset.Fields(10)
DTPicker2.Value = Adodc2.Recordset.Fields(11)
Text9.Text = DTPicker2.Value - DTPicker1.Value
If DTPicker3.Value <= DTPicker2.Value Then
Text10.Text = 0
Else
Text10.Text = DTPicker3.Value - DTPicker2.Value
End If
Text1.Enabled = True
Else
MsgBox "没有此读者的相关信息或者此读者书籍已经全部归还!", vbOKOnly, "提示"
Text1.Text = ""
Text1.Enabled = False
Text2.Text = ""
Text2.SetFocus
End If
Adodc2.RecordSource = "select * from dzjstb where 借='还'"
Adodc2.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -