Home > Software engineering >  A simple database and vb join query problems, seek help, newcomers can not find out the problem
A simple database and vb join query problems, seek help, newcomers can not find out the problem

Time:09-21


After running the results said like near the wrong,,, but really think there is no
Please help have a look at where need change thanks!

CodePudding user response:

STRSQL="Select * From library where"
STRSQL=STRSQL & amp; "Title"
STRSQL=STRSQL & amp; "LiKe '%" & amp; Trim (Text1. Text) & amp; "% '
"No error code above the debugging, can query the records, the following figure,

CodePudding user response:

 t=Option1 (Index). The Index 

Instead of
 For t=1 To 3 
If Option1 (t). The Value Then Exit the For
Next

CodePudding user response:

 dim strwhere as string 
STRSQL="select * from library where 1=1"
The select case t
Case 1
Strwhere="and the title like '" & amp; Trim (text1. Text) & amp;" "
% 'Case 2
Strwhere="and the like the call '" & amp; Trim (text1. Text) & amp;" "
% 'Case 3
Strwhere="and the author like '" & amp; Trim (text1. Text) & amp;" "
% 'In case the else
Strwhere=""
End the select

STRSQL=STRSQL & amp; Strhwere

CodePudding user response:

Your Option controls were Option4, Option5, Option6,
 
STRSQL="SELECT *" comes FROM
If Text1 & gt; "" Then
If Option4. Value=https://bbs.csdn.net/topics/True Then
STRSQL=STRSQL & amp; "WHERE the title LIKE '%" & amp; Text1 & amp; "% '
"ElseIf Option5. Then Value=https://bbs.csdn.net/topics/True
STRSQL=STRSQL & amp; "WHERE the call LIKE '%" & amp; Text1 & amp; "% '
"The Else
STRSQL=STRSQL & amp; "WHERE the author LIKE '%" & amp; Text1 & amp; "% '
"End the If
End the If

CodePudding user response:

You add a debug in vb. Print STRSQL
IDE environment after the operation in the immediate window to display the SQL string copy and paste to the server management operation, and look at what is the problem
  • Related