📄 frmloginchange.frm
字号:
VERSION 5.00
Object = "{CE671F01-259E-40DA-92FE-95803E2ECBB5}#1.0#0"; "SMARTXPBUTTON.OCX"
Begin VB.Form FrmLoginChange
BackColor = &H00E0E0E0&
BorderStyle = 3 'Fixed Dialog
Caption = "更改系统登陆用户"
ClientHeight = 1875
ClientLeft = 30
ClientTop = 330
ClientWidth = 3960
Icon = "FrmLoginChange.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1875
ScaleWidth = 3960
ShowInTaskbar = 0 'False
Begin VB.ComboBox Combo1
BackColor = &H00DFFFF8&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 330
Left = 1260
Style = 2 'Dropdown List
TabIndex = 0
Top = 252
Width = 2460
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H00DFFFF8&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 324
IMEMode = 3 'DISABLE
Left = 1260
MaxLength = 20
PasswordChar = "*"
TabIndex = 1
Top = 768
Width = 2460
End
Begin SmartXPButton.XpButton Command1
Default = -1 'True
Height = 435
Left = 420
TabIndex = 2
Top = 1260
Width = 1335
_ExtentX = 2355
_ExtentY = 767
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "确定(&O)"
PictureSmoothBackColor= 13882323
ButtonPicture = "FrmLoginChange.frx":030A
End
Begin SmartXPButton.XpButton Command2
Height = 435
Left = 2100
TabIndex = 3
Top = 1260
Width = 1335
_ExtentX = 2355
_ExtentY = 767
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "退出(&X)"
PictureSmoothBackColor= 13882323
ButtonPicture = "FrmLoginChange.frx":0464
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H00C0C0C0&
BackStyle = 0 'Transparent
Caption = "密 码:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 210
Left = 180
TabIndex = 5
Top = 825
Width = 1050
End
Begin VB.Label Label2
AutoSize = -1 'True
BackColor = &H00C0C0C0&
BackStyle = 0 'Transparent
Caption = "登陆用户:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 210
Left = 180
TabIndex = 4
Top = 300
Width = 1050
End
End
Attribute VB_Name = "FrmLoginChange"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim cn As New ADODB.Connection
Dim Rec As New ADODB.Recordset
Private Sub Combo1_Click()
On Error Resume Next
Text1.SetFocus
End Sub
Private Sub Command1_Click()
Dim TempPwd As String
Dim TempLgUser As String
TempPwd = MdlMain.ConVertPwd(Text1.Text)
TempLgUser = Trim(Left(Combo1.Text, InStr(Combo1.Text, " | ")))
Set Rec = cn.Execute("select * from loginuser where userbh='" & TempLgUser & "'")
If Rec.Fields("password").Value <> TempPwd Then
MsgBox "密码不正确,请重新输入...", vbOKOnly + vbInformation, "出错!"
TempPwd = ""
Text1.SetFocus
Exit Sub
End If
MdlMain.LoginBh = Trim(Left(Combo1.Text, InStr(Combo1.Text, " | ")))
MdlMain.LoginUser = Trim(Right(Combo1.Text, Len(Combo1.Text) - InStr(Combo1.Text, " | ") - 2))
MdlMain.Password = TempPwd
Rec.Close
Set Rec = Nothing
Rec.CursorLocation = adUseClient
Rec.Open "select loginwarrant.*,logingn.gnname from loginwarrant,logingn where " & _
"logingn.bh=loginwarrant.bh and left(loginwarrant.bh,1)<>'^' and " & _
"loginwarrant.[userbh]='" & MdlMain.LoginBh & "'", cn, adOpenDynamic, adLockOptimistic
ReDim MdlMain.LoginQx(0)
If Not Rec.EOF And Not Rec.BOF Then
Do While Not Rec.EOF
ReDim Preserve MdlMain.LoginQx(UBound(MdlMain.LoginQx, 1) + 1)
MdlMain.LoginQx(UBound(MdlMain.LoginQx, 1) - 1).QxName = Rec.Fields("bh").Value
MdlMain.LoginQx(UBound(MdlMain.LoginQx, 1) - 1).Warrant = Rec.Fields("warrant").Value
Rec.MoveNext
Loop
End If
FrmMain.Caption = "水费卫生费管理系统(当前用户:" & MdlMain.LoginUser & ")"
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyEscape Then Unload Me
End Sub
Private Sub Form_Load()
Me.Left = GetSetting(App.EXEName, "更改登陆用户", "left", (Screen.Width - Me.Width) / 2)
Me.Top = GetSetting(App.EXEName, "更改登陆用户", "top", (Screen.Height - Me.Height) / 2)
Me.KeyPreview = True
Text1.Text = ""
cn.Open DbLoginSql
Set Rec = cn.Execute("select * from loginuser order by userbh")
If Rec.EOF And Rec.BOF Then
cn.BeginTrans
cn.Execute "delete from loginwarrant"
Rec.AddNew
Rec.Fields("userbh").Value = "000"
Rec.Fields("username").Value = "supervistor"
Rec.Fields("password").Value = ConVertPwd("")
Rec.Update
cn.CommitTrans
Dim Rec1 As New ADODB.Recordset
Rec1.CursorLocation = adUseClient
Rec1.Open "select * from logingn,loginuser where loginuser.[username]='supervistor'", _
cn, adOpenDynamic, adLockOptimistic
If Not Rec1.EOF And Not Rec1.BOF Then
Do While Not Rec1.EOF
cn.Execute "insert into loginwarrant([userbh],[username],bh,[warrant]) " & _
" Values('" & Rec1.Fields("userbh") & "','" & Rec1.Fields("username") & _
"','" & Rec1.Fields("bh") & "','1')"
Rec1.MoveNext
Loop
End If
Rec1.Close
Set Rec1 = Nothing
Set Rec = cn.Execute("select * from loginuser")
End If
Rec.MoveFirst
Do While Not Rec.EOF
Combo1.AddItem Rec.Fields("userbh") & " | " & Rec.Fields("username")
Rec.MoveNext
Loop
Combo1.Text = Combo1.List(0)
End Sub
Private Sub Form_Unload(Cancel As Integer)
SaveSetting App.EXEName, "更改登陆用户", "left", Me.Left
SaveSetting App.EXEName, "更改登陆用户", "top", Me.Top
On Error Resume Next
Rec.Close
Set Rec = Nothing
cn.Close
Set cn = Nothing
End Sub
Private Sub Text1_GotFocus()
Text1.Text = ""
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -