當前位置:編程學習大全網 - 網站源碼 - asp if 多條件判斷怎麽寫?

asp if 多條件判斷怎麽寫?

c<>3 or c<>4 or c<>5

這樣寫是不對的,因為這意味著三個條件中只要有任何壹個成立,結果就成立。比如c=3時,盡管第壹個條件不成立,但後面兩個條件是成立的,因此整個表達式就成立。這就意味著,不管是什麽數(包括3、4、5)結果都是成立的!

應該改為

if a=1 and b=2 and c<>3 and c<>4 and c<>5 then

代碼中的則改為

if xm = rs("sb") and rs("jd") ="審查" and dj<>1 and dj<>2 and dj<>3 and dj<>4 then

或者

if xm = rs("sb") and rs("jd") ="審查" and (dj<1 or dj>4) then

或者

if xm = rs("sb") and rs("jd") ="審查" and not (dj>0 and dj<5) then

  • 上一篇:誰能做壹個全屏MV視頻?
  • 下一篇:濟源的郵政編碼是多少
  • copyright 2024編程學習大全網