班级通讯录管理系统

班级通讯录管理系统
修改密码

Private Sub 命令6_Click()
Dim rs As New ADODB.Recordset
Dim rss As New ADODB.Recordset
Dim x As String
Dim conn As New ADODB.Connection
Dim strql As String
Dim n As Integer
strql = "select count(用户.用户名) from 用户 where 用户名=" & "'" & text0 & "'"
strql = strql & "and 密码 =" & "'" & text2 & "'"
x = "update 用户 set 用户.密码=" & "'" & text10 & "'" & "where 用户名=" & "'" & text0 & "'"
Set conn = CurrentProject.Connection
rs.Open strql, conn, adOpenKeyset, adLockOptimistic
n = rs(0)
If n = 1 Then
rss.Open x, conn, adOpenKeyset, adLockOptimistic
MsgBox "修改成功"
DoCmd.Close
Else
MsgBox "原密码错误"
End If
End Sub
密码检查Private Sub 命令4_Click()
Dim rs As New ADODB.Recordset
Dim conn As New ADODB.Connection
Dim strql As String
Dim n As Integer

strql = "select count(用户.用户ID) from 用户 where 用户名=" & "'" & text1 & "'"
strql = strql & "and 密码 =" & "'" & text2 & "'"
Set conn = CurrentProject.Connection
rs.Open strql, conn, adOpenKeyset, adLockOptimistic
n = rs(0)
If IsNull(text1) Or IsNull(text2) Then
 MsgBox "用户名或密码不能为空"
Else
 If n = 1 Then
  'DoCmd.OpenForm "主窗体"
  DoCmd.RunMacro "宏1"
  DoCmd.Close acForm, "窗体4"
  Else
  MsgBox "密码不正确"
  End If
 End If
End Sub436

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有