
access转sql:在关键字 'top' 附近有语法错误,请高手帮忙解决
<%ifcity=""thensql="selecttop3*fromnyeee_datawheremark='yes'andmark='yes'andstop>=get...
<%
if city="" then
sql="select top 3 * from nyeee_data where mark='yes' and mark='yes' and stop >= getdate() and shouye=1 and pic <>'' order by top desc,money desc,adid desc"
else
sql="select top 3 * from nyeee_data where mark='yes' and city ='"&city&"' and mark='yes' and stop >= getdate() and shouye=1 and pic <>'' order by top desc,money desc,adid desc"
end if
set rs=server.createobject("adodb.recordset")
rs.open sql,connstr,1,1
if rs.eof then%>
提示“top”附近有语法错误,请帮忙看看,谢谢 展开
if city="" then
sql="select top 3 * from nyeee_data where mark='yes' and mark='yes' and stop >= getdate() and shouye=1 and pic <>'' order by top desc,money desc,adid desc"
else
sql="select top 3 * from nyeee_data where mark='yes' and city ='"&city&"' and mark='yes' and stop >= getdate() and shouye=1 and pic <>'' order by top desc,money desc,adid desc"
end if
set rs=server.createobject("adodb.recordset")
rs.open sql,connstr,1,1
if rs.eof then%>
提示“top”附近有语法错误,请帮忙看看,谢谢 展开
2个回答
展开全部
TOP是SQL保留字你改成:[top]
<%
if city="" then
sql="select top 3 * from nyeee_data where mark='yes' and mark='yes' and stop >= getdate() and shouye=1 and pic <>'' order by [top] desc,money desc,adid desc"
else
sql="select top 3 * from nyeee_data where mark='yes' and city ='"&city&"' and mark='yes' and stop >= getdate() and shouye=1 and pic <>'' order by [top] desc,money desc,adid desc"
end if
set rs=server.createobject("adodb.recordset")
rs.open sql,connstr,1,1
if rs.eof then%>
<%
if city="" then
sql="select top 3 * from nyeee_data where mark='yes' and mark='yes' and stop >= getdate() and shouye=1 and pic <>'' order by [top] desc,money desc,adid desc"
else
sql="select top 3 * from nyeee_data where mark='yes' and city ='"&city&"' and mark='yes' and stop >= getdate() and shouye=1 and pic <>'' order by [top] desc,money desc,adid desc"
end if
set rs=server.createobject("adodb.recordset")
rs.open sql,connstr,1,1
if rs.eof then%>
展开全部
改为
<%
if city="" then
sql="select top 3 * from nyeee_data where mark='yes' and stop >= getdate() and shouye=1 and pic <>"" order by top desc,money desc,adid desc"
else
sql="select top 3 * from nyeee_data where mark='yes' and city ='"&city&"' and stop >= getdate() and shouye=1 and pic <>"" order by top desc,money desc,adid desc"
你的top字段是什么意思?
<%
if city="" then
sql="select top 3 * from nyeee_data where mark='yes' and stop >= getdate() and shouye=1 and pic <>"" order by top desc,money desc,adid desc"
else
sql="select top 3 * from nyeee_data where mark='yes' and city ='"&city&"' and stop >= getdate() and shouye=1 and pic <>"" order by top desc,money desc,adid desc"
你的top字段是什么意思?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询