+ -
当前位置:首页 → 问答吧 → 请教高手这个难题?

请教高手这个难题?

时间:2010-10-09

来源:互联网

下面的sql有三种写法都报错,在and附近有语法错误,有谁能指出来吗?  

age 是INT类型

VBScript code
response.CacheControl = "no-cache"
response.AddHeader "pragma","no-cache"
response.Expires=-1
dim sex,age1,age2,country,p,maxNum
dim reStr
sex=trim(request.QueryString("sex"))
age1=request.QueryString("age1")
age2=request.QueryString("age2")
country=trim(request.QueryString("country"))
p=trim(request.QueryString("p"))
if isempty(p) or (not isNumeric(p)) then p=int(rnd()*100)   
p=int(p)
if p>maxNum then p=maxNum

set rs=server.createobject("adodb.recordset")  
'sql="select top 1 id,uid,PICPATH from ladlady where [id] > " & p & " and uid IN(select uid,Gender, age,Country from customer1 where Gender='"&sex&"' and (age BETWEEN "&age1&" and "&age2&") and Country ='"&country&"') order by [id] asc"  
'sql="select top 1 id,uid,PICPATH from ladlady where [id] > " & p & " and uid IN(select uid,Gender, age,Country from customer1 where Gender='"&sex&"' and ( age > "&age1&" and age < "&age2&") and Country ='"&country&"') order by [id] asc"  
sql="select top 1 id,uid,PICPATH from ladlady s,customer1 t where [id] > " & p & " and t.Gender='"&sex&"' and t.age > "&age1&" and t.age < "&age2&" and t.Country='"&country&"'"

rs.open sql,conn,1,1
'...... 

 
 

作者: frankrenping   发布时间: 2010-10-09

maxNum没赋值啊

Response.Write sql
看是什么

作者: net_lover   发布时间: 2010-10-09

引用 1 楼 net_lover 的回复:
maxNum没赋值啊

Response.Write sql
看是什么


应该是age1或者age2没有获取到值导致出错,输出sql语句看看是否语法错误

作者: showbo   发布时间: 2010-10-09

热门下载

更多