怎么判断是最后一条数据的时候不显示逗号?
Dim rslou,nmnm = Easp.R("n","1:10")Set rslou = Easp.db.GetRecordBySQL("SELECT TOP "&nm&" chrloupan, shouloutel, avgprice, filepath, chraddress FROM mh163k_house_loupan WHERE iskill = 1 ORDER BY loupanid DESC")While Not rslou.eofa="["while not rslou.eof and not rslou.bofb="{""id"":"&rslou("shouloutel")&",""title"":"&rslou("shouloutel")&"},"rslou.movenext()a=a&bwenda=a&"]"response.write(a)WendEasp.db.C(rslou)
'不要去判断,影响效率,直接去掉最后一个b=left(b,len(b)-1)'或b=mid(b,1,len(b)-1)a=a&b
[解决办法]
strComma = ""while not rslou.eof and not rslou.bof b="{""id"":"&rslou("shouloutel")&",""title"":"&rslou("shouloutel")&"}" rslou.movenext() a=a & strComma & b strComma = ","wend