Home > Software engineering >  The great spirit show SQL statements which point wrong, the first query conditions don't come o
The great spirit show SQL statements which point wrong, the first query conditions don't come o

Time:09-27

Dim strQuery As String
If Checkpinzhong. Value=https://bbs.csdn.net/topics/1 Then
If strQuery="" Then
StrQuery="pinzhong like '% %'" + txtpinzhong. Text + ", "
The Else
StrQuery=strQuery & amp; "And pinzhong like '% %'" + txtpinzhong. Text + ", "
End the If
End the If
If Checkfengchan. Value=https://bbs.csdn.net/topics/1 Then
If strQuery="" Then
StrQuery="fengchanxing like '% %'" + txtfengchan. Text + ", "
The Else
StrQuery=strQuery & amp; "And fengchanxing like '% %'" + txtfengchan. Text + ", "
End the If
End the If
Adodc1. RecordSource="select * from Taoziyuan where" & amp; StrQuery
Adodc1. Refresh
Exit Sub

CodePudding user response:

Repeated questions

CodePudding user response:

Dim strPinZhong as string
Dim strFengChan as string
If Checkpinzhong. Value=https://bbs.csdn.net/topics/1 Then
StrPingZhong="and pinzhong like '% %'" + txtpinzhong. Text + ", "
The Else
StrPingZhong=""
End the If
If Checkfengchan. Value=https://bbs.csdn.net/topics/1 Then
StrFengChan="and fengchanxing like '% %'" + txtfengchan. Text + ", "
The Else
StrFengChan=""
End the If
Adodc1. RecordSource="select * from Taoziyuan where 1"=1 "& amp; StrPingZhong & amp; strFengChan
  • Related