frm_password.frm
上传用户:xxdyjx888
上传日期:2022-06-01
资源大小:55k
文件大小:4k
源码类别:

家庭/个人应用

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Begin VB.Form frm_password 
  3.    Caption         =   "修改密码"
  4.    ClientHeight    =   3405
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   4185
  8.    Icon            =   "frm_password.frx":0000
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    ScaleHeight     =   3405
  12.    ScaleWidth      =   4185
  13.    StartUpPosition =   2  'CenterScreen
  14.    Begin VB.CommandButton Command2 
  15.       Caption         =   "取消"
  16.       Height          =   375
  17.       Left            =   2520
  18.       TabIndex        =   7
  19.       Top             =   2640
  20.       Width           =   855
  21.    End
  22.    Begin VB.CommandButton Command1 
  23.       Caption         =   "确定"
  24.       Height          =   375
  25.       Left            =   840
  26.       TabIndex        =   6
  27.       Top             =   2640
  28.       Width           =   855
  29.    End
  30.    Begin VB.TextBox Text3 
  31.       Height          =   375
  32.       IMEMode         =   3  'DISABLE
  33.       Left            =   2040
  34.       PasswordChar    =   "*"
  35.       TabIndex        =   5
  36.       Top             =   1800
  37.       Width           =   1455
  38.    End
  39.    Begin VB.TextBox Text2 
  40.       Height          =   375
  41.       IMEMode         =   3  'DISABLE
  42.       Left            =   2040
  43.       PasswordChar    =   "*"
  44.       TabIndex        =   4
  45.       Top             =   1080
  46.       Width           =   1455
  47.    End
  48.    Begin VB.TextBox Text1 
  49.       Height          =   375
  50.       IMEMode         =   3  'DISABLE
  51.       Left            =   2040
  52.       PasswordChar    =   "*"
  53.       TabIndex        =   3
  54.       Top             =   360
  55.       Width           =   1455
  56.    End
  57.    Begin VB.Label Label3 
  58.       BackStyle       =   0  'Transparent
  59.       Caption         =   "再输入一遍:"
  60.       Height          =   375
  61.       Left            =   480
  62.       TabIndex        =   2
  63.       Top             =   1920
  64.       Width           =   1215
  65.    End
  66.    Begin VB.Label Label2 
  67.       BackStyle       =   0  'Transparent
  68.       Caption         =   "新密码:"
  69.       Height          =   375
  70.       Left            =   840
  71.       TabIndex        =   1
  72.       Top             =   1200
  73.       Width           =   855
  74.    End
  75.    Begin VB.Label Label1 
  76.       BackStyle       =   0  'Transparent
  77.       Caption         =   "旧密码:"
  78.       Height          =   375
  79.       Left            =   840
  80.       TabIndex        =   0
  81.       Top             =   480
  82.       Width           =   975
  83.    End
  84. End
  85. Attribute VB_Name = "frm_password"
  86. Attribute VB_GlobalNameSpace = False
  87. Attribute VB_Creatable = False
  88. Attribute VB_PredeclaredId = True
  89. Attribute VB_Exposed = False
  90. Dim Mydb As New ADODB.Recordset
  91. Dim Str_text As String
  92. Private Sub Command1_Click()
  93.             On Error Resume Next
  94.             Dim Password As String
  95.             Dim Newpassword As String
  96.             
  97.             Password = Text1.Text
  98.             Newpassword = Text2.Text
  99.             
  100.             Set Mydb = ExeCutesql("SELECT pass from user1 WHERE user='" & Cname & "'", Str_text)
  101.             'MsgBox "select pass from user1 where user='" & Cname & "'"
  102.             
  103.             If Not Password = Mydb.Fields(0) Then
  104.                   MsgBox "原密码输入错误!", vbOKOnly + 32, "注意"
  105.                   Text2.Text = ""
  106.                   Text3.Text = ""
  107.                   Text2.SetFocus
  108.             Else
  109.                If Text3.Text <> Newpassword Then
  110.                   MsgBox "你两次输入密码不一致,请重新输入!", vbOKOnly + 32, "注意"
  111.                   Text1.SetFocus
  112.                Else
  113.                   ExeCutesql "UPDATE user1 SET pass= '" & Newpassword & "' where user='" & Cname & "'", ""
  114.                   MsgBox "密码更改成功!", vbOKOnly + 64, "注意"
  115.                   Unload Me
  116.                End If
  117.             End If
  118. End Sub
  119. Private Sub Command2_Click()
  120.             Unload Me
  121.             frm_main.Show
  122. End Sub