?? frmadduser.frm
字號:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmadduser
BackColor = &H00FFFFFF&
BorderStyle = 3 'Fixed Dialog
Caption = "添加系統用戶"
ClientHeight = 2475
ClientLeft = 45
ClientTop = 330
ClientWidth = 4470
Icon = "frmadduser.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
Picture = "frmadduser.frx":030A
ScaleHeight = 2475
ScaleWidth = 4470
ShowInTaskbar = 0 'False
Begin VB.OptionButton Option2
BackColor = &H00E0E0E0&
Height = 180
Left = 1860
TabIndex = 11
Top = 1020
Width = 210
End
Begin VB.OptionButton Option1
BackColor = &H00E0E0E0&
Height = 180
Left = 840
TabIndex = 10
Top = 1020
Width = 210
End
Begin VB.CommandButton cmdclose
Caption = "關閉&(C)"
Height = 300
Left = 3360
TabIndex = 8
Top = 2040
Width = 1000
End
Begin VB.CommandButton cmdupdate
Caption = "更新&(C)"
Height = 300
Left = 2280
TabIndex = 7
Top = 2040
Width = 1000
End
Begin VB.CommandButton cmddelete
Caption = "刪除&(D)"
Height = 300
Left = 1200
TabIndex = 6
Top = 2040
Width = 1000
End
Begin VB.CommandButton cmdadd
Caption = "添加&(A)"
Height = 300
Left = 120
TabIndex = 5
Top = 2040
Width = 1000
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 240
Top = 1320
Width = 2640
_ExtentX = 4657
_ExtentY = 582
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 = 16777215
ForeColor = 16711680
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = ""
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.TextBox Text2
BackColor = &H00FFFFFF&
ForeColor = &H000000FF&
Height = 300
Left = 840
TabIndex = 4
Top = 600
Width = 2000
End
Begin VB.TextBox Text1
BackColor = &H00FFFFFF&
ForeColor = &H000000FF&
Height = 300
Left = 840
TabIndex = 3
Top = 240
Width = 2000
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "超級用戶"
Height = 180
Left = 2100
TabIndex = 13
Top = 1020
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "普通用戶"
Height = 180
Left = 1080
TabIndex = 12
Top = 1020
Width = 720
End
Begin VB.Line Line1
BorderColor = &H000000FF&
X1 = 120
X2 = 4320
Y1 = 1900
Y2 = 1900
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
BorderStyle = 1 'Fixed Single
Caption = " 注意:用戶名和密碼不得超過10個中文字符或20個英文字母,密碼最好用英文或數字。"
ForeColor = &H00000000&
Height = 1440
Left = 3120
TabIndex = 9
Top = 240
Width = 1155
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "權 限"
Height = 180
Left = 225
TabIndex = 2
Top = 1020
Width = 540
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "密 碼"
Height = 180
Left = 225
TabIndex = 1
Top = 675
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用戶名"
Height = 180
Left = 240
TabIndex = 0
Top = 300
Width = 540
End
End
Attribute VB_Name = "frmadduser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public uright As String
Private Sub Form_Load()
On Error GoTo err1
frmadduser.Top = (frmmain.Height - frmadduser.Height) / 2 - 500
frmadduser.Left = (frmmain.Width - frmadduser.Width) / 2
Option1.Value = True
cmdupdate.Caption = "修改"
With Adodc1
.ConnectionString = frmlogin.conn
.RecordSource = "select * from usertab order by ID"
.Refresh
.Caption = "共有用戶" & .Recordset.RecordCount & "個"
Set Text1.DataSource = Adodc1
Set Text2.DataSource = Adodc1
Text1.DataField = "用戶名"
Text2.DataField = "密碼"
End With
Exit Sub
err1:
MsgBox "數據庫連接失敗!"
End Sub
Private Sub Form_Unload(Cancel As Integer)
Screen.MousePointer = vbDefault
frmlogin.userright = "1"
End Sub
Private Sub cmdAdd_Click()
On Error GoTo AddErr
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "用戶名和密碼必須填寫!"
Else
With Adodc1
.Recordset.AddNew
.Recordset.Fields("權限") = uright
End With
cmdadd.Enabled = False
cmdupdate.Caption = "保存"
End If
Exit Sub
AddErr:
MsgBox "數據添加失敗!可能是數據庫連接出錯。"
End Sub
Private Sub cmdDelete_Click()
On Error GoTo DeleteErr
With Adodc1.Recordset
If .Fields("用戶名") = "systemuser" Then
MsgBox "系統默認用戶不能刪除!"
Else
.Delete
.MoveNext
.UpdateBatch
If .EOF Then .MoveLast
End If
End With
Exit Sub
DeleteErr:
MsgBox "數據庫已空或無法連接數據!"
End Sub
Private Sub cmdUpdate_Click()
On Error GoTo UpdateErr
If cmdupdate.Caption = "保存" Then
If Adodc1.Recordset.Fields("用戶名") = "systemuser" Then
MsgBox "系統默認用戶名不能修改,密碼可以修改!"
Else
Adodc1.Recordset.UpdateBatch
cmdadd.Enabled = True
cmdupdate.Caption = "修改"
End If
Else
Adodc1.Recordset.Fields("用戶名") = Text1.Text
Adodc1.Recordset.Fields("密碼") = Text2.Text
Adodc1.Recordset.Fields("權限") = uright
End If
Exit Sub
UpdateErr:
MsgBox "數據無記錄或數據庫損壞!"
End Sub
Private Sub cmdClose_Click()
Unload Me
MsgBox "系統已將用戶權限修改為普通用戶!"
End Sub
Private Sub Option2_Click()
uright = "0"
cmdupdate.Caption = "保存"
End Sub
Private Sub Option1_Click()
uright = "1"
cmdupdate.Caption = "保存"
End Sub
Private Sub Text1_Change()
If Text1.Text = "systemuser" Then
Text1.Enabled = False
Else
Text1.Enabled = True
End If
cmdupdate.Caption = "修改"
End Sub
Private Sub Text2_Change()
cmdupdate.Caption = "修改"
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -