aspif可以分開判斷代碼的簡單介紹
1、Sql=quotselect name from wjfile where weburl=1 and ID=quotID end if url=articleaspwidd1aclassd1這個(gè)是文章收藏時(shí)所附加的url判斷,其余模塊也必須附件并修改,例如圖片的url=;sql=quotselect * from fangchanxinxi where xqmc=#39quotxqmcquot#39 and hxjg=#39quothxjgquot#39 and jg=#39quotjgquot#39 and lc=#39quotlcquot#39 and jzmj=#39quotjzmjquot#39quotrsopen sql,conn,1,1 if not rseof then response;那就在 endif 處 加一行 end if 簡單的看 你2個(gè)if 只有一個(gè)end if 你去掉下面的else 能運(yùn)行是因?yàn)榈?個(gè)if 后面then 你后面跟了zt=“b” 這樣就等這個(gè)if 結(jié)束了 可以不寫end if 但你加else 后 就必須有對(duì)應(yīng)的。
2、exec=quotinsert into 會(huì)員a, b, c,d,e,fvalues#39quot+a+quot#39,quot+b+quot,#39quot+c+quot#39,#39quot+d+quot#39,#39quot+e+quot#39,#39quot+f+quot#39quot你的SQL寫得不對(duì),這樣是jscript的,但你沒指定,所以系統(tǒng)默認(rèn)應(yīng)該用vbscript的語法 變量的連接;你的判斷應(yīng)該寫在后臺(tái)中這樣寫 前臺(tái)lt%# BindTitleEvalquotTitlequot 后臺(tái)的cs文件中寫一個(gè)方法,如下public string BindTitleobject title if titleToStringLengthlt5 titleToString else title;多條件,如果條件個(gè)數(shù)不是很多可以這樣寫if T10 and T2=0 or T3lt0 then #39執(zhí)行語句 end if 但是多條件判斷一般采用條件控制語句select case 例如id=requestquotidquotselect case id case 1 #39執(zhí)行語句1 case 2。
3、if IsNumericdh=false then ResponseWrite quotwindowalert#39請(qǐng)輸入正確的電話號(hào)碼電話號(hào)碼只能為純數(shù)字!#39historyback1quotResponseEnd end if;你兩段代碼可以改下簡潔點(diǎn)lt%sql=quotselect * from newstype2 order by nu ,id descquotrs_type1=myRs1,sqlq=0while!rs_type1EOFq++style = quotquotifq%3==1 style = quot style=quotquot;if then 是條件判斷語句,如果需要兩個(gè)條件同時(shí)成立則需要加 and語法如下if 條件1 and 條件2 then 滿足條件執(zhí)行的代碼end if如果是或者的情況則需要用 or語法如下if 條件1 or 條件2 then 滿足其中一個(gè)條件所執(zhí)行的;rCount = rs1recordcount i = 0 if i lt rCount or daydate=8 and Sessionquotsession_adminrightquotlt 25 then #39時(shí)間判斷可以寫在這里% lta href=quotshow_bbasp?bbgl_bm_id=lt%=bbgl_bm_id%q。
4、dim rowcount call connExecutequotupdate tb set D=D+D1 where A=A1 and B=B1 and C=C1 and E=E1quot , rowcountif rowcount = 0 then call connExecutequotinsert into tbA,B,C,D,E select A1,B1;判斷不為空的時(shí)候再賦值,這樣才對(duì)rsopen sql1,conn,1,1 if not rseof then hmdd=rsquott10quotend if rsclose。
掃描二維碼推送至手機(jī)訪問。
版權(quán)聲明:本文由飛速云SEO網(wǎng)絡(luò)優(yōu)化推廣發(fā)布,如需轉(zhuǎn)載請(qǐng)注明出處。