📄 frmuser.frm
字号:
Width = 1455
End
Begin VB.Label Label7
Caption = "电子邮件:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 8
Top = 2640
Width = 1455
End
Begin VB.Label Label6
Caption = "联系电话:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 7
Top = 2160
Width = 1455
End
Begin VB.Label Label5
Caption = "出生日期:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 6
Top = 1680
Width = 1455
End
Begin VB.Label Label4
Caption = "性 别:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 5
Top = 1200
Width = 1455
End
Begin VB.Label Label3
Caption = "性 名:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 4
Top = 720
Width = 1455
End
Begin VB.Label Label2
Caption = "用户编号:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 3
Top = 240
Width = 1455
End
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 0
Top = 5880
Visible = 0 'False
Width = 7575
_ExtentX = 13361
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "UB,Books"
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 TabDlg.SSTab SSTab
Height = 375
Left = 0
TabIndex = 1
Top = 600
Width = 6525
_ExtentX = 11509
_ExtentY = 661
_Version = 393216
TabHeight = 520
TabCaption(0) = "用户基本信息"
TabPicture(0) = "FrmUser.frx":0032
Tab(0).ControlEnabled= -1 'True
Tab(0).ControlCount= 0
TabCaption(1) = "借书记录"
TabPicture(1) = "FrmUser.frx":004E
Tab(1).ControlEnabled= 0 'False
Tab(1).ControlCount= 0
TabCaption(2) = "图书查询"
TabPicture(2) = "FrmUser.frx":006A
Tab(2).ControlEnabled= 0 'False
Tab(2).ControlCount= 0
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "普通用户"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 0
TabIndex = 0
Top = 120
Width = 7695
End
End
Attribute VB_Name = "FrmUser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Command1.Visible = False
Command2.Visible = False
Command3.Visible = True
Command4.Visible = True
SSTab.TabEnabled(1) = False
SSTab.TabEnabled(2) = False
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Text6.Enabled = True
Text7.Enabled = True
Text8.Enabled = True
End Sub
Private Sub Command2_Click()
tablename = "Users"
FrmMima.Show 1
End Sub
Private Sub Command3_Click()
Dim set_str As String
Dim where_str As String
Call connect_db
set_str = "Uname='" & Text2.Text & "',Usex='" & Text3.Text & "',Uborn='" & Text4.Text & "',Utel='" & Text5.Text & "',Uemail='" & Text6.Text & "',Uaddr='" & Text7.Text & "',Uremark='" & Text8.Text & "'"
where_str = "Uid='" & Text1.Text & "'"
Call upd_table("Users", set_str, where_str)
MsgBox ("信息更新成功")
Command1.Visible = True
Command2.Visible = True
Command3.Visible = False
Command4.Visible = False
SSTab.TabEnabled(1) = True
SSTab.TabEnabled(2) = True
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
End Sub
Private Sub Command4_Click()
Call connect_db
Call sel_table("Users", "where Uid='" & Text1.Text & "'")
If rst.RecordCount > 0 Then
Text2.Text = rst("Uname")
Text3.Text = rst("Usex") & ""
Text4.Text = rst("Uborn") & ""
Text5.Text = rst("Utel") & ""
Text6.Text = rst("Uemail") & ""
Text7.Text = rst("Uaddr") & ""
Text8.Text = rst("Uremark") & ""
End If
Command1.Visible = True
Command2.Visible = True
Command3.Visible = False
Command4.Visible = False
SSTab.TabEnabled(1) = True
SSTab.TabEnabled(2) = True
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
End Sub
Private Sub Command5_Click()
Dim str As String
Dim sql As String
Call connect_db
If Text9.Text = "" Then
If Check1.Value = 1 Then
Call sel_table("Books", "")
Else
Call sel_table("Books", "where Bid not in (select Bid from UB)")
End If
Else
If Combo1.Text = "书名" Then
str = "Bname"
ElseIf Combo1.Text = "图书编号" Then
str = "Bid"
ElseIf Combo1.Text = "作者" Then
str = "Bwriter"
ElseIf Combo1.Text = "出版社" Then
str = "Bbookman"
End If
If Check1.Value = 1 Then
If str = "Bid" Then
Call sel_table("Books", "where Bid='" & Text9.Text & "'")
Else
Call sel_table("Books", "where " & str & " like '%" & Text9.Text & "%'")
End If
Else
If str = "Bid" Then
Call sel_table("Books", "where Bid=' " & Text9.Text & "' and Bid not in (select Bid from UB)")
Else
Call sel_table("Books", "where " & str & " like '%" & Text9.Text & "%' and Bid not in (select Bid from UB)")
End If
End If
End If
Set DataGrid1.DataSource = rst
With DataGrid1
.Columns(0).Caption = "图书编号"
.Columns(1).Caption = "书名"
.Columns(2).Caption = "类型"
.Columns(3).Caption = "作者"
.Columns(4).Caption = "出版社"
.Columns(5).Caption = "出版日期"
.Columns(6).Caption = "图书简介"
End With
Label9.Caption = "一共有" & rst.RecordCount & "本书"
End Sub
Private Sub Command6_Click()
Unload Me
End Sub
Private Sub Form_Load()
Combo1.Text = "书名"
End Sub
Private Sub Form_Unload(Cancel As Integer)
FrmMain.Show
End Sub
Private Sub SSTab_Click(PreviousTab As Integer)
Select Case SSTab.Tab
Case 0:
FrmUser.Height = 6720
Picture1.Visible = True
Picture2.Visible = False
Picture1.Top = 960
Call connect_db
Call sel_table("Users", "where Uid='" & Text1.Text & "'")
If rst.RecordCount > 0 Then
Text2.Text = rst("Uname")
Text3.Text = rst("Usex") & ""
Text4.Text = rst("Uborn") & ""
Text5.Text = rst("Utel") & ""
Text6.Text = rst("Uemail") & ""
Text7.Text = rst("Uaddr") & ""
Text8.Text = rst("Uremark") & ""
End If
Case 1:
FrmUser.Height = 6720
Picture1.Visible = False
Picture2.Visible = True
Picture3.Visible = False
Picture2.Top = 960
DataGrid1.Height = 4800
DataGrid1.Top = 0
Call connect_db
Set rst = New ADODB.Recordset
sql = "select Books.Bid,Bname,Borrow_time,Return_time,Over_time from UB,Books where Uid='" & Text1.Text & "' and UB.Bid=Books.Bid"
rst.Open sql, con, adOpenDynamic, adLockOptimistic
rst.Requery
Set DataGrid1.DataSource = rst
With DataGrid1
.Columns(0).Caption = "图书编号"
.Columns(1).Caption = "书名"
.Columns(2).Caption = "借书时间"
.Columns(3).Caption = "应还书时间"
.Columns(4).Caption = "超出天数"
End With
Label9.Caption = "你一共借书" & rst.RecordCount & "本!还可再借" & 15 - rst.RecordCount & "本!"
Case 2:
FrmUser.Height = 6720
Picture1.Visible = False
Picture2.Visible = True
Picture3.Visible = True
Picture2.Top = 960
DataGrid1.Height = 4350
DataGrid1.Top = 450
Combo1.Text = "书名"
Call connect_db
Call sel_table("Books", "")
Set DataGrid1.DataSource = rst
With DataGrid1
.Columns(0).Caption = "图书编号"
.Columns(1).Caption = "书名"
.Columns(2).Caption = "类型"
.Columns(3).Caption = "作者"
.Columns(4).Caption = "出版社"
.Columns(5).Caption = "出版日期"
.Columns(6).Caption = "图书简介"
End With
Label9.Caption = "一共有" & rst.RecordCount & "本书"
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -