ASP不同时间调用数据库里不同的文章

来源:百度知道 编辑:UC知道 时间:2024/06/11 19:02:41
打算在不同的时间段在网站首页调用数据库中的文章,
具体如下:
0:00-06:00调用数据库里Gq_Article1字段为art_Title(标题)字段Content(内容)的文章
06:00-12:00调用数据库里Gq_Article2字段为art_Title(标题)字段Content(内容)的文章
12:00-18:00调用数据库里Gq_Article3字段为art_Title(标题)字段Content(内容)的文章
18:00-24:00调用数据库里Gq_Article4字段为art_Title(标题)字段Content(内容)的文章
需要在首页显示,希望高手帮忙解决一下 谢谢!!

试试看,不一定能达到你的目的,设置页面定时自动刷新:(下面的判断语句,好像用select case不行)
<%
mytime=time()
if mytime<=#6:00:00# then
table="Gq_Article1"
elseif mytime<=#12:00:00# then
table="Gq_Article2"
elseif mytime<=#18:00:00# then
table="Gq_Article3"
else
table="Gq_Article4"
end if
set rs=conn.execute("select art_Title,Content from "&table&"")
%>

<%
dim h,table
h=time()
if h <=cdate("6:00") then
table = "Gq_Article1"
elseif h>cdate("6:00") and h <=cdate("12:00") then
table = "Gq_Article2"
elseif h>cdate("12:00") and h <=cdate("18:00") then
table = "Gq_Article3"
else
table = "Gq_Article4"
end if

sql="select art_Title,Content from " & table & " where 条件 order by 排序"

%>