Home > database >  Many conditions query problem
Many conditions query problem

Time:09-27

Have which met the question: the first line near 'andand have grammar mistake! How to change? Please advice each master!

CodePudding user response:

The source SQL posted to see,,,

CodePudding user response:

Related to query you set conditions there is something wrong with the value (in general)

CodePudding user response:

Two and certainly wrong,

CodePudding user response:

The post code, you don't come out who knows where you went wrong

CodePudding user response:

The code is as follows:
String oldsql, newsql
Int I=1
Datetime rq1 and rq2
Time ti1, ti2
Ti1=time (' 00:00:00)
Ti2=time (' 23:59:59)
Rq1=datetime (date (em_3. Text), ti1)
Rq2=datetime (date (em_4. Text), ti2)

Oldsql=dw_3. The describe (" datawindow. Table. Select ")
Newsql="datawindow. Table. Select='" + oldsql



If cbx_15. Checked=true then
If isnull (sle_10. Text)=true or sle_10. Text="" then
Messagebox (" I'm sorry ", please enter the query condition! "" , stopsign! , ok!
Return
The else
If not I=0 then
Newsql=newsql + "and"

The else
Newsql=newsql + "where"
End the if
Newsql=newsql + "(ZLJSWJB GCRCLMLH=~" "+ upper (trim (sle_10. Text)) +" - ") "
I++
End the if
End the if

If cbx_13. Checked=true then
If isnull (sle_12. Text)=true or sle_12. Text="" then
Messagebox (" I'm sorry ", please enter the query condition! "" , stopsign! , ok!
Return
The else
If not I=0 then
Newsql=newsql + "and"

The else
Newsql=newsql + "where"
End the if
Newsql=newsql + "(ZLJSWJB CPMC like ~" % "+ trim (sle_12. Text) +" % ~ ") "
I++
End the if
End the if

If cbx_16. Checked=true then
If isnull (sle_13. Text)=true or sle_13. Text="" then
Messagebox (" I'm sorry ", please enter the query condition! "" , stopsign! , ok!
Return
The else
If not I=0 then
Newsql=newsql + "and"

The else
Newsql=newsql + "where"
End the if
Newsql=newsql + "(ZLJSWJB GCRCLLH=~" "+ upper (trim (sle_13. Text)) +" - ") "
I++
End the if
End the if

If cbx_17. Checked=true then
If isnull (sle_14. Text)=true or sle_14. Text="" then
Messagebox (" I'm sorry ", please enter the query condition! "" , stopsign! , ok!
Return
The else
If not I=0 then
Newsql=newsql + "and"

The else
Newsql=newsql + "where"
End the if
Newsql=newsql + "(ZLJSWJB BRJH like ~" % "+ trim (sle_14. Text) +" % ~ ") "
I++
End the if
End the if

If cbx_18. Checked=true then
If isnull (sle_15. Text)=true or sle_15. Text="" then
Messagebox (" I'm sorry ", please enter the query condition! "" , stopsign! , ok!
Return
The else
If not I=0 then
Newsql=newsql + "and"

The else
Newsql=newsql + "where"
End the if
Newsql=newsql + "(ZLJSWJB BRGH=~" "+ trim (sle_15. Text) +" - ") "
I++
End the if
End the if

If cbx_19. Checked=true then
If isnull (em_3. Text)=true and em_3. Text="and" isnull (em_4. Text)=true and em_4. Text="" then
Messagebox (" note ", "please enter the period")
Return
The else
If not I=0 then
Newsql=newsql + "and"

The else
Newsql=newsql + "where"
End the if

Newsql=newsql + "ZLJSWJB RKRQ between" + "-" "+ string (rq1) +" - "" +" and "+" - "" + string (rq2) +" - ""

I++
End the if
End the if


Newsql=newsql + "'"
Dw_3. Modify (newsql)
Dw_3. Retrieve (rq1 and rq2)


Dw_3. Modify (" datawindow. Table. Select='" + oldsql + "' ")


If dw_3. Rowcount ()=0 then
Messagebox (" note ", "not retrieve data")
Return
end if

CodePudding user response:

Typography is too messy,

Newsql=newsql + "'"
"' here shows newsql, see which part appeared in two consecutive and
Dw_3. Modify (newsql)
Dw_3. Retrieve (rq1 and rq2)

CodePudding user response:

Dw_3. Modify (newsql)

Before messagebox (' newsq, newsql) data to see what it is,,,

CodePudding user response:

Faint, is a bit tricky, debugged!

CodePudding user response:

Application problems

Int I=1
If not I=0 then//why to write, not is i<> 0
Newsql=newsql + "and"
The else

Are well behind the
If not I=0 then//why to write, not is i<> 0
Newsql=newsql + "and"
The else

I=1, the nature is not equal to zero, affirmation is the and

CodePudding user response:

By the top

CodePudding user response:

The top,

CodePudding user response:

After another wall bumps

CodePudding user response:

Analysis is very good

CodePudding user response:

Analysis is very good

CodePudding user response:

Thank you all for the guidance, the problem has been solved!

CodePudding user response:


Int I=1
If not I=0 then//why to write, not is i<> 0
Newsql=newsql + "and"
The else


I=1, that nature is not equal to zero, affirmation is the and the

CodePudding user response:

references 9 f xys_777 response:

question of procedure
Int I=1
If not I=0 then//why to write, not is i<> 0
Newsql=newsql + "and"
The else

Are well behind the
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related