?? frmsc.frm
字號:
VERSION 5.00
Begin VB.Form frmsc
BorderStyle = 1 'Fixed Single
Caption = "刪除用戶"
ClientHeight = 3015
ClientLeft = 45
ClientTop = 330
ClientWidth = 4710
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3015
ScaleWidth = 4710
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 2760
TabIndex = 5
Top = 2280
Width = 855
End
Begin VB.CommandButton Command1
Caption = "確定"
Height = 375
Left = 1080
TabIndex = 4
Top = 2280
Width = 855
End
Begin VB.TextBox Text2
Height = 375
IMEMode = 3 'DISABLE
Left = 2280
MaxLength = 20
PasswordChar = "*"
TabIndex = 3
Top = 1320
Width = 2055
End
Begin VB.TextBox Text1
Height = 375
Left = 2280
MaxLength = 20
TabIndex = 1
Top = 480
Width = 2055
End
Begin VB.Label Label2
Caption = "密碼:"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 2
Top = 1320
Width = 1215
End
Begin VB.Label Label1
Caption = "用戶名:"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 0
Top = 480
Width = 1215
End
End
Attribute VB_Name = "frmsc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
'聲明變量
Dim cnn As New ADODB.Connection
Dim ret As New ADODB.Recordset
Dim local_db As String
Dim username As String
Dim password As String
username = Trim(Text1.Text)
password = Text2.Text
'檢查文本框是否為空
If username = "" Then
MsgBox "請輸入用戶名", , "警告"
Text1.SetFocus
Else
If password = "" Then
MsgBox "請輸入密碼", , "警告"
Text2.SetFocus
End If
End If
'檢查用戶是否存在
If username <> "" And password <> "" Then
Set cnn = New ADODB.Connection
Set ret = New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path & "\data\db.mdb" + ";Persist Security Info=False;" '連接數據庫
local_db = "select 用戶名 from 用戶表" + _
" where 用戶表.用戶名=" + "'" + username + "'"
ret.Open local_db, cnn
If ret.BOF And ret.EOF Then
MsgBox "系統中無此用戶", , "警告"
Text1.Text = "" '初始化文本框
Text2.Text = ""
Text1.SetFocus '設置光標焦點
ret.Close
'檢查密碼是否正確
Else
ret.Close
local_db = "select 用戶名 from 用戶表" + _
" where 用戶表.用戶名=" + "'" + username + "' and" + _
" 用戶表.密碼=" + "'" + password + "'"
ret.Open local_db, cnn
If ret.BOF And ret.EOF Then
MsgBox "密碼錯誤", , "警告"
ret.Close
Else
'禁止刪除admin
If username = "admin" Then
MsgBox "不能刪除admin", , "警告"
Text1.Text = "" '初始化文本框
Text2.Text = ""
Text1.SetFocus '設置光標焦點
Else
'刪除用戶
ret.Close
ts1.Show
Beep
frmsc.Enabled = False
mainfrm.Enabled = False
End If
End If
End If
End If
End Sub
Private Sub Command2_Click()
frmsc.Hide
Text1.Text = "" '初始化文本框
Text2.Text = ""
'初始化主窗口
mainfrm.guanli.Enabled = True
mainfrm.chaxun.Enabled = True
mainfrm.tongji.Enabled = True
If userid = "admin" Then
mainfrm.xitong.Enabled = True
mainfrm.bdb.Enabled = True
Else
mainfrm.xitong.Enabled = False
mainfrm.bdb.Enabled = False
End If
mainfrm.Command1.Enabled = True
mainfrm.Command2.Enabled = True
mainfrm.Command3.Enabled = True
If userid = "admin" Then
mainfrm.Command4.Enabled = True
Else
mainfrm.Command4.Enabled = False
End If
GetStatus "<就緒>"
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -