Dim UserName As String = e.Form.Controls("UserName").Value
Dim UserGroup As String = e.Form.Controls("UserGroup").Value
Dim PassWord As String = e.Form.Controls("PassWord").Value
Dim OldUserName As String
Dim dt As DataTable
Dim dr As DataRow
Dim cmd As New SQLCommand
Dim Parts() As String = e.Form.Text.Split("-")
OldUserName = Parts(Parts.Length -1)
cmd.C
cmd.CommandText = "Select * From {Users} Where [Name] = '" & UserName & "'"
dt = cmd.ExecuteReader
dr = dt.DataRows(0)
If e.Form.Controls("OldPassWord").Value = dr("Password") Then
cmd.CommandText = "Update {Users} Set [Name] = '" & UserName & "',[Group] = '" & UserGroup
cmd.CommandText = cmd.CommandText & "', [Password] = '" & Password & "' Where [Name]= '" & OldUserName & "'"
If cmd.ExecuteNonQuery = 1 Then '返回1表示更改成功
Messagebox.show("密码更改成功,切记新设密码!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
Else
Messagebox.show("老密码错误,更改失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
请问专家这代码哪出错了,老是不执行新密码写入,急急