Private Sub Command1_Click()
On Error Resume Next
Dim conn As New ADODB.Connection
Dim Rs As ADODB.Recordset
Dim str
str = App.Path
If Right(str, 1) <> "\" Then
str = str + "\"
End If
str = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=" & str & "\sparta.mdb"
SQL = "select 密码 from 助教信息 where 用户名='sparta'"
Set Rs = New ADODB.Recordset
Rs.Open SQL, str, 1, 3
If Trim(Text1.Text) = Trim(Rs.Fields(0).Value) Then
SQL = "update 助教信息 set 密码='" & Text2.Text & "'"
conn.Execute (SQL)
Text1.Text = ""
Text2.Text = ""
MsgBox "修改成功!", , "提示信息"
Else
MsgBox "原密码错误!", , "提示信息"
End If
End Sub
代码如上
但登陆时 还是用原密码登陆,意思就是 改完了 没生效