Home > Software engineering >  Please help to have a look at this code appear what problem
Please help to have a look at this code appear what problem

Time:09-30

//text4 as the user name, text1 for the old password, text2 for the new password, text3 to confirm password,
Private Sub Command1_Click ()

Dim TXTSQL As String
Private Sub ok_Click ()
If the Trim (Text4. Text)="" Then
MsgBox "the user name cannot be empty!" , vbExclamation + vbOKOnly, "warning"
Text4. SetFocus
The Exit Sub
End the If
If the Trim (Text2. Text) & lt;> Trim (Text3. Text) Then
MsgBox "two password is not the same!" , and "password"
The Exit Sub
End the If
If the Trim (Text3. Text)="" Or Trim (Text1. Text)=" "Or Trim (Text2. Text)=" "Then
MsgBox "username or password cannot be empty!" , vbExclamation + vbOKOnly, "warning"
The Exit Sub
End the If
Dim MRC As ADODB. You
MRC. Open TXTSQL="select * from the users where the username='" & amp; Text4. Text & amp; "'
"The Set of MRC=the ExecuteSQL (TXTSQL)
MRC. AddNew
If MRC. RecordCount=0 Then MsgBox "the user does not exist!" VbExclamation, "user"
The Exit Sub
End the If
MRC. Fields (" userpwd ")=Trim (Text1. Text)
MRC. UpdateBatch
MsgBox "password change success!" , and "success"
Text4. Text=""
Text1. Text=""
Text2. Text=""
Text3. Text=""

End Sub

CodePudding user response:

1. Private Sub Command1_Click () or Private Sub ok_Click ()
There is a line is redundant,
2. If MRC. Behind MsgBox RecordCount=0 Then this sentence to write a newline, or code is wrong grammar structure,

CodePudding user response:

This database operations inside the code if you have any questions I don't know,
No "actual environment", there is a problem also can not guess,
  • Related