Home > Software engineering >  Vb syntax errors, near the From running
Vb syntax errors, near the From running

Time:09-25

Prompt box shows the From nearby have grammatical errors, but can run, at the top is the Adodc1
My code is as follows:
 If Text1. Text & gt; "" And Text2. Text & gt; "" Then 
Adodc1. RecordSource="select * from permissions table where user name='" & amp; Text1. Text & amp; "' And password='" & amp; Text2. Text & amp; "'
"Adodc1.Com mandType=adCmdText
Adodc1. Refresh
If Adodc1. You. RecordCount & gt;
0 Then 'has dataAdodc1. You. MoveFirst
If the Trim (Text2. Text) & lt;> Trim (Adodc1. You. Fields (" password ")) Then 'check user password
MsgBox "原始密码错误,请重新输入", , "提示:"
The Else
If the Trim (Text4. Text) & lt;> Trim (Text3. Text) Then
MsgBox "password, re-enter", and "tip:
"Text4. Text=""
The Else
Adodc1. You. Fields (" password ")=Trim (Text4. Text)
Adodc1. You. Update
MsgBox "password is changed", and "tip:
"End the If
End the If
The Else
MsgBox "the user name and password does not exist", and "tip:
"End the If
The Else
MsgBox "the user name and password cannot be empty", and "tip:
"End the If
End Sub
Private Sub Text2_keydown (keycode As an Integer, shift the As an Integer)
If keycode=13 Then
Call Command1_Click
End the If
End Sub

CodePudding user response:

Is here "' And password='" less a space before?

CodePudding user response:

The table name, field name to use [] surround the try again,

CodePudding user response:

Have tried, no, is still the same

CodePudding user response:

 Adodc1. RecordSource="select * from permissions table where user name='" & amp; Text1. Text & amp; "' And password='" & amp; Text2. Text & amp; "' 
"Is amended as:
Adodc1. RecordSource="select * from permissions table where user name='" & amp; Text1. Text & amp; "' And password='" & amp; Text2. Text & amp; "'
"And there should be a space in front of the, if Texi1=abcd, Text2=1234
You generated after is the original statement: select * from permissions table where name='abcd' And password='1234'
Revised: select * from permissions table where name='abcd' And password='1234'
Is a mistake in stealth,

CodePudding user response:

reference 4 floor u013249970 response:
 Adodc1. RecordSource="select * from permissions table where user name='" & amp; Text1. Text & amp; "' And password='" & amp; Text2. Text & amp; "' 
"Is amended as:
Adodc1. RecordSource="select * from permissions table where user name='" & amp; Text1. Text & amp; "' And password='" & amp; Text2. Text & amp; "'
"And there should be a space in front of the, if Texi1=abcd, Text2=1234
You generated after is the original statement: select * from permissions table where name='abcd' And password='1234'
Revised: select * from permissions table where name='abcd' And password='1234'
Is a mistake in stealth,

I said in the 1/f, reply this, and on the third floor of the building Lord reply, is not this the reason for the error,

CodePudding user response:

Then I built a form, program copy the past, to run, there is no hint, don't know why,

CodePudding user response:

It is not your Adodc properties, some Settings does not accord with your operating environment?
(I never use this stuff, not clear details )
  • Related