📄 usermsg.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form usermsg
BorderStyle = 1 'Fixed Single
Caption = "用户信息"
ClientHeight = 4170
ClientLeft = 45
ClientTop = 330
ClientWidth = 6795
LinkTopic = "Form2"
MaxButton = 0 'False
MDIChild = -1 'True
Picture = "usermsg.frx":0000
ScaleHeight = 4170
ScaleWidth = 6795
Begin MSComctlLib.ListView ListView1
Height = 1455
Left = 120
TabIndex = 15
Top = 2520
Width = 6495
_ExtentX = 11456
_ExtentY = 2566
Arrange = 1
Sorted = -1 'True
LabelWrap = -1 'True
HideSelection = 0 'False
FullRowSelect = -1 'True
GridLines = -1 'True
HotTracking = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = 14737632
Appearance = 1
NumItems = 0
End
Begin VB.CommandButton Command2
Caption = " 关闭"
Height = 375
Left = 2280
Picture = "usermsg.frx":9C09
Style = 1 'Graphical
TabIndex = 13
Top = 1800
Width = 975
End
Begin VB.CommandButton Command1
Caption = "修改"
Height = 375
Left = 600
Picture = "usermsg.frx":C469
Style = 1 'Graphical
TabIndex = 12
Top = 1800
Width = 855
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
Height = 270
Index = 5
Left = 5280
Locked = -1 'True
TabIndex = 9
Text = "Text1"
Top = 1320
Width = 975
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
Height = 270
Index = 4
Left = 3120
Locked = -1 'True
TabIndex = 8
Text = "Text1"
Top = 1320
Width = 975
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
Height = 270
Index = 3
Left = 1320
Locked = -1 'True
TabIndex = 7
Text = "Text1"
Top = 1320
Width = 975
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
Height = 270
Index = 2
Left = 5280
TabIndex = 6
Text = "Text1"
Top = 480
Width = 975
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
Height = 270
Index = 1
Left = 3120
Locked = -1 'True
TabIndex = 5
Text = "Text1"
Top = 480
Width = 975
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
Height = 270
Index = 0
Left = 1320
Locked = -1 'True
TabIndex = 4
Text = "Text1"
Top = 480
Width = 975
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "Label3"
Height = 180
Left = 4800
TabIndex = 16
Top = 1920
Width = 540
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "如果您是普通用户,只能修改密码"
Height = 180
Left = 1680
TabIndex = 14
Top = 120
Width = 2700
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "罚金"
Height = 180
Index = 5
Left = 4440
TabIndex = 11
Top = 1320
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "班级"
Height = 180
Index = 4
Left = 2640
TabIndex = 10
Top = 1320
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "所在系别"
Height = 180
Index = 3
Left = 360
TabIndex = 3
Top = 1320
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "密码"
Height = 180
Index = 2
Left = 4440
TabIndex = 2
Top = 480
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "姓名"
Height = 180
Index = 1
Left = 2640
TabIndex = 1
Top = 480
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "借书证号"
Height = 180
Index = 0
Left = 360
TabIndex = 0
Top = 480
Width = 720
End
End
Attribute VB_Name = "usermsg"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim sql As String
Dim i As Integer
If Trim(level) = "0" Then '修改密码
If Trim(Text1(2).Text) = "" Then
MsgBox "对不起您修改的密码不能为空! ", 64, "提示"
Text1(2).SetFocus
Else
sql = "select * from person where username='" & username & "'" & " and password='" & password & "'"
opendb sql, "2"
rs("password") = Trim(Text1(2).Text)
If Val(Trim(Label3.Caption)) <> 0 Then
rs("money") = Val(Trim(Label3.Caption))
End If
rs.Update
password = Trim(Text1(2).Text)
closedb
usermsg.Hide
MsgBox "密码修改成功!", 64, "提示"
usermsg.Show
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim sql As String
Dim i As Integer
Dim j As Integer
Dim bookname As String
Label3.Visible = False
'显示借书情况
ListView1.View = lvwReport
ListView1.ColumnHeaders.Add , , "借书证号"
ListView1.ColumnHeaders.Add , , "借书人姓名"
ListView1.ColumnHeaders.Add , , "图书编号"
ListView1.ColumnHeaders.Add , , "书名"
ListView1.ColumnHeaders.Add , , "价格"
ListView1.ColumnHeaders.Add , , "类别"
ListView1.ColumnHeaders.Add , , "出版社"
ListView1.ColumnHeaders.Add , , "借出日期"
ListView1.ColumnHeaders.Add , , "应还日期"
sql = "select * from lendbook where username='" & username & "'"
opendb sql, ""
If rs.EOF Then
MsgBox "您没有借书!", 64, "提示"
Else
ListView1.View = lvwReport
For j = 1 To rs.RecordCount '列出用户所借的书
ListView1.ListItems.Add , , rs.Fields("username") & vbNullString
With ListView1.ListItems(j)
.SubItems(1) = rs.Fields("name") & vbNullString
.SubItems(2) = rs.Fields("bookno") & vbNullString
.SubItems(3) = rs.Fields("booktitle") & vbNullString
.SubItems(4) = rs.Fields("price") & vbNullString
.SubItems(5) = rs.Fields("sort") & vbNullString
.SubItems(6) = rs.Fields("press") & vbNullString
.SubItems(7) = rs.Fields("lenddate") & vbNullString
.SubItems(8) = rs.Fields("backdate") & vbNullString
End With
'统计罚金
If Date - CDate(rs("backdate")) > 0 Then
If setflag = False Then
money = money + (Date - CDate(rs("backdate"))) * 0.1
Else
money = money + (Date - CDate(rs("backdate"))) * fine
End If
End If
'统计过期书名
If (Date - CDate(rs("backdate"))) > 0 Then
bookname = bookname & "《" & rs("booktitle") & "》,"
End If
rs.MoveNext
Next
End If
closedb
If Right(bookname, 1) = "," Then
bookname = Mid(bookname, 1, InStrRev(bookname, ",") - 1)
End If
If Trim(bookname) <> "" And money > 0 Then
MsgBox "您的" & Trim(bookname) & "已经过期,请尽快还掉。您所要交的罚金是:" & Trim(Str(money)) & "元", 64, "提示"
ElseIf Trim(bookname) <> "" Then
MsgBox "您的" & Trim(bookname) & "已经过期,请尽快还掉", 64, "提示"
ElseIf money > 0 Then
MsgBox "您要交的罚金:" & Trim(Str(money)) & "元", 64, "提示"
End If
'更新罚金字段
sql = "select * from person where username='" & username & "'" & " and password='" & password & "'"
opendb sql, "2"
If money <> 0 Then
rs("money") = money
End If
rs.Update
closedb
'显示用户资料
sql = "select * from person where username='" & username & "'" & " and password='" & password & "'"
opendb sql, ""
If rs.EOF Then
MsgBox "没有您的资料!", 64, "提示"
Else
For i = 0 To rs.Fields.Count - 4
Text1(i).Text = rs(i + 1) & " "
Next
End If
closedb
End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
Call Command1_Click
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -