📄 用户信息.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form 用户信息
Caption = "用户信息"
ClientHeight = 8100
ClientLeft = 60
ClientTop = 465
ClientWidth = 10005
LinkTopic = "Form1"
ScaleHeight = 8100
ScaleWidth = 10005
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command8
Caption = "放弃"
Enabled = 0 'False
Height = 375
Left = 4380
TabIndex = 23
Top = 6900
Width = 1095
End
Begin VB.CommandButton Command7
Caption = "下一条"
Height = 375
Left = 8340
TabIndex = 21
Top = 6900
Width = 1155
End
Begin VB.CommandButton Command6
Caption = "上一条"
Height = 375
Left = 7020
TabIndex = 20
Top = 6900
Width = 1095
End
Begin VB.TextBox Text8
DataField = "职工号"
DataSource = "Adodc1"
Height = 390
Left = 1380
TabIndex = 19
Top = 300
Width = 2115
End
Begin MSAdodcLib.Adodc Adodc1
Height = 435
Left = 1260
Top = 7620
Visible = 0 'False
Width = 2655
_ExtentX = 4683
_ExtentY = 767
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Medicine;Data Source=刘莹"
OLEDBString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Medicine;Data Source=刘莹"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select workno as 职工号,userregname as 用户名,password as 密码,position as 职位,power as 权限,name as 姓名 from userinfor"
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 Frame1
Caption = "输入查找信息"
Height = 2175
Left = 4920
TabIndex = 13
Top = 600
Visible = 0 'False
Width = 4095
Begin VB.CommandButton Command5
Caption = "确定"
Height = 435
Left = 3060
TabIndex = 18
Top = 1560
Width = 795
End
Begin VB.TextBox Text7
Height = 435
Left = 900
TabIndex = 17
Top = 1080
Width = 1995
End
Begin VB.TextBox Text6
Height = 435
Left = 900
TabIndex = 16
Top = 420
Width = 1995
End
Begin VB.Label Label7
Caption = "职位:"
Height = 375
Left = 300
TabIndex = 15
Top = 1200
Width = 795
End
Begin VB.Label Label6
Caption = "姓名:"
Height = 435
Left = 300
TabIndex = 14
Top = 540
Width = 1275
End
End
Begin VB.CommandButton Command4
Caption = "查找"
Height = 375
Left = 5760
TabIndex = 12
Top = 6900
Width = 1035
End
Begin VB.CommandButton Command3
Caption = "修改"
Height = 375
Left = 3060
TabIndex = 11
Top = 6900
Width = 1035
End
Begin VB.CommandButton Command2
Caption = "删除"
Height = 375
Left = 1800
TabIndex = 10
Top = 6900
Width = 1035
End
Begin VB.CommandButton Command1
Caption = "新增"
Height = 375
Left = 480
TabIndex = 9
Top = 6900
Width = 1095
End
Begin VB.TextBox Text5
DataField = "姓名"
DataSource = "Adodc1"
Height = 375
Left = 1380
TabIndex = 8
Top = 2760
Width = 2115
End
Begin VB.TextBox Text4
DataField = "权限"
DataSource = "Adodc1"
Height = 375
Left = 1380
TabIndex = 6
Top = 2100
Width = 2115
End
Begin VB.TextBox Text3
DataField = "职位"
DataSource = "Adodc1"
Height = 375
Left = 1380
TabIndex = 4
Top = 1500
Width = 2115
End
Begin VB.TextBox Text1
DataField = "用户名"
DataSource = "Adodc1"
Height = 375
Left = 1380
TabIndex = 2
Top = 900
Width = 2115
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "用户信息.frx":0000
Height = 3375
Left = 420
TabIndex = 0
Top = 3420
Width = 9135
_ExtentX = 16113
_ExtentY = 5953
_Version = 393216
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.Label Label8
Caption = "职工号:"
Height = 315
Left = 540
TabIndex = 22
Top = 360
Width = 975
End
Begin VB.Label Label5
Caption = "姓名:"
Height = 315
Left = 540
TabIndex = 7
Top = 2820
Width = 915
End
Begin VB.Label Label4
Caption = "权限:"
Height = 315
Left = 540
TabIndex = 5
Top = 2160
Width = 855
End
Begin VB.Label Label3
Caption = "职位:"
Height = 255
Left = 540
TabIndex = 3
Top = 1560
Width = 915
End
Begin VB.Label Label1
Caption = "用户名:"
Height = 315
Left = 540
TabIndex = 1
Top = 960
Width = 1635
End
End
Attribute VB_Name = "用户信息"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
On Error Resume Next
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command8.Enabled = True
If Command1.Caption = "新增" Then
Command1.Caption = "确认"
Adodc1.Recordset.AddNew
Text1.SetFocus
Else
Command1.Caption = "新增"
Adodc1.Recordset.Update
Adodc1.Recordset.MoveLast
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
End If
End Sub
Private Sub Command2_Click()
On Error Resume Next
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveFirst
End Sub
Private Sub Command3_Click()
On Error Resume Next
Command1.Enabled = False
Command2.Enabled = False
Command8.Enabled = True
If Command3.Caption = "修改" Then
Command3.Caption = "确认"
Adodc1.Recordset.Update
Text1.SetFocus
Else
Command3.Caption = "修改"
Adodc1.Recordset.Update
Command1.Enabled = True
Command2.Enabled = True
Command4.Enabled = True
End If
End Sub
Private Sub Command4_Click()
Frame1.Visible = True
End Sub
Private Sub Command5_Click()
Adodc1.RecordSource = "select workno as 职工号,userregname as 用户名,position as 职位,power as 权限,name as 姓名 from userinfor where name='" & Text6.Text & "' and position='" & Text7 & "'"
Adodc1.Refresh
If Adodc1.Recordset.EOF Then
MsgBox "无此信息!", , "提示"
Adodc1.RecordSource = "select workno as 职工号,userregname as 用户名,position as 职位,power as 权限,name as 姓名 from userinfor"
Adodc1.Refresh
Text6.Text = ""
Text7.Text = ""
Text6.SetFocus
End If
End Sub
Private Sub Command6_Click()
Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF Then
Adodc1.Recordset.MoveFirst
MsgBox "当前记录为第一条", , "提示"
End If
End Sub
Private Sub Command7_Click()
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveLast
MsgBox "当前记录为最后一条", , "提示"
End If
End Sub
Private Sub Command8_Click()
Command1.Enabled = True: Command2.Enabled = True
Command3.Enabled = True: Command8.Enabled = False
Command4.Enabled = True: Command3.Caption = "修改"
Command1.Caption = "添加"
On Error GoTo RefreshErr
Adodc1.Refresh
Exit Sub
RefreshErr:
MsgBox Err.Description
End Sub
Private Sub Form_Load()
Adodc1.RecordSource = "select workno as 职工号,userregname as 用户名,position as 职位,power as 权限,name as 姓名 from userinfor"
Adodc1.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -