⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form3.frm

📁 VB和SQL的应用,VB和数据库的连接,极其相关功能
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form3 
   Caption         =   "Form3"
   ClientHeight    =   5160
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   7470
   LinkTopic       =   "Form3"
   ScaleHeight     =   5160
   ScaleWidth      =   7470
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Left            =   5640
      TabIndex        =   7
      Top             =   3600
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Left            =   3960
      TabIndex        =   6
      Top             =   3600
      Width           =   1335
   End
   Begin VB.TextBox Text3 
      Height          =   495
      Left            =   2520
      TabIndex        =   4
      Top             =   2400
      Width           =   2655
   End
   Begin VB.TextBox Text2 
      Height          =   495
      Left            =   2520
      TabIndex        =   1
      Top             =   1680
      Width           =   2655
   End
   Begin VB.TextBox Text1 
      Height          =   495
      Left            =   2520
      TabIndex        =   0
      Top             =   960
      Width           =   2655
   End
   Begin VB.Label Label3 
      Caption         =   "确认密码"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   840
      TabIndex        =   5
      Top             =   2400
      Width           =   1335
   End
   Begin VB.Label Label2 
      Caption         =   "新密码"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   840
      TabIndex        =   3
      Top             =   1680
      Width           =   1455
   End
   Begin VB.Label Label1 
      Caption         =   "原始密码"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   840
      TabIndex        =   2
      Top             =   960
      Width           =   1455
   End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cn As New adodb.Connection
Dim rs As New adodb.Recordset

Private Sub Command1_Click()
Dim a As String
Dim b As String
Dim c As String
a = Form1.Text1.Text
b = Me.Text1.Text
   If Me.Text2.Text = Me.Text3.Text And Form1.Text2.Text = b Then
    Do Until rs.EOF
l:
       If a = rs.Fields(0).Value And b = rs.Fields(1).Value Then
        c = Me.Text2.Text
        rs.Update 1, c
        Unload Me
        MsgBox "非常好!密码已经修改完毕。请您牢记!"
        End
'        Form1.Show
        'rs.MoveFirst
        'cn.Close
        Exit Do
        
        Else
        rs.MoveNext
        If Not rs.EOF Then GoTo l
        End If
        Loop
    Else
       If Me.Text1.Text <> Form1.Text2.Text And Me.Text2.Text = Me.Text3.Text Then
        MsgBox "原密码不对,请确认后继续!"
       ElseIf Me.Text1.Text = Form1.Text2.Text And Me.Text2.Text <> Me.Text3.Text Then
       MsgBox "您输入的新密码与确认密码不符,请重新输入!"
       Else
       MsgBox "您输入的新密码与确认密码不符或原密码不对,请重新输入!"
       End If
    End If

rs.MoveFirst

End Sub

Private Sub Command2_Click()
Form3.Visible = False
Form1.Show
End Sub

Private Sub Form_Load()
Set cn = Nothing
Set rs = Nothing
Dim str As String
str = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=科研管理信息系统"
cn.CursorLocation = adUseClient
cn.Open str
rs.CursorLocation = adUseClient
rs.Open "用户和密码", cn, adOpenDynamic, adLockPessimistic
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -