asp按时间调用数据库
<%ifnews_id=""thenResponse.write"参数错误!"Response.endendifusrsql1="SELECT*FROM[news_pag...
<%
if news_id="" then
Response.write "参数错误!"
Response.end
end if
usrsql1="SELECT*FROM [news_page] where news_id="&news_id&" "
Set usrrs1 = Server.CreateObject("ADODB.Recordset")
usrrs1.open usrsql1,Conn
if usrrs1.eof then
mains="该部份内容尚未编辑!"
end if
news_name=usrrs1("news_title")
mains=usrrs1("news_main")
time_s=usrrs1("news_time")
classs=usrrs1("news_class")
news_pic=usrrs1("news_pic")
usrrs1.close
set usrrs1=nothing
%>
麻烦改一下,谢谢!!
这是我写的调用数据的SQL语句,现在我需要按时间来调用内容,时间最新的在最前面。请问如何修改后才能实现?? 展开
if news_id="" then
Response.write "参数错误!"
Response.end
end if
usrsql1="SELECT*FROM [news_page] where news_id="&news_id&" "
Set usrrs1 = Server.CreateObject("ADODB.Recordset")
usrrs1.open usrsql1,Conn
if usrrs1.eof then
mains="该部份内容尚未编辑!"
end if
news_name=usrrs1("news_title")
mains=usrrs1("news_main")
time_s=usrrs1("news_time")
classs=usrrs1("news_class")
news_pic=usrrs1("news_pic")
usrrs1.close
set usrrs1=nothing
%>
麻烦改一下,谢谢!!
这是我写的调用数据的SQL语句,现在我需要按时间来调用内容,时间最新的在最前面。请问如何修改后才能实现?? 展开
3个回答
展开全部
这是你写的??这是根据传入的参数来取数据的?你要取第一条的话。。
<%
usrsql1="SELECT * FROM [news_page] order by news_id desc"
Set usrrs1 = Server.CreateObject("ADODB.Recordset")
usrrs1.open usrsql1,Conn,1,1
if usrrs1.eof then
mains="该部份内容尚未编辑!"
end if
news_name=usrrs1("news_title")
mains=usrrs1("news_main")
time_s=usrrs1("news_time")
classs=usrrs1("news_class")
news_pic=usrrs1("news_pic")
usrrs1.close
set usrrs1=nothing
%>
<%
usrsql1="SELECT * FROM [news_page] order by news_id desc"
Set usrrs1 = Server.CreateObject("ADODB.Recordset")
usrrs1.open usrsql1,Conn,1,1
if usrrs1.eof then
mains="该部份内容尚未编辑!"
end if
news_name=usrrs1("news_title")
mains=usrrs1("news_main")
time_s=usrrs1("news_time")
classs=usrrs1("news_class")
news_pic=usrrs1("news_pic")
usrrs1.close
set usrrs1=nothing
%>
展开全部
问题没表达清楚.请细仔点.别人不会花精力去猜你的问题.太累.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
采用倒序排列
usrsql1="SELECT*FROM [news_page] where news_id="&news_id&" by news_id desc"
usrsql1="SELECT*FROM [news_page] where news_id="&news_id&" by news_id desc"
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询