asp中如何随机读取数据库数据
<%setrs=server.createobject("adodb.recordset")rs.open"selecttop8*frommedicine_zcwhere...
<%
set rs=server.createobject("adodb.recordset")
rs.open "select top 8 * from medicine_zc where Effect order by adddate desc",conn,1,1
if rs.eof and rs.bof then
response.write "<tr><td align=center>暂无信息</td></tr>"
else
for dydesign=1 to 7
%> 展开
set rs=server.createobject("adodb.recordset")
rs.open "select top 8 * from medicine_zc where Effect order by adddate desc",conn,1,1
if rs.eof and rs.bof then
response.write "<tr><td align=center>暂无信息</td></tr>"
else
for dydesign=1 to 7
%> 展开
2013-12-04
展开全部
<%
Set conn=server.CreateObject("adodb.connection")
conn.provider="microsoft.jet.oledb.4.0"团乱答
conn.open server.mappath("english.mdb")Set rs=server.CreateObject("adodb.recordset")
rs.open "select * from sentence",conn,1,1 '先读取全部记录max=rs.recordcount ‘读取最塌慧大记录数
For i=1 To 7 ’随机输出7个
randomize
id=Int(Rnd(now)*max+1) ‘定义从1到最大记录数之间的随机记录号
rs.absoluteposition=id ’定义记录集的陪扒绝对指针
Response.Write rs(0)&rs(1)&rs(2)
Next
%>
Set conn=server.CreateObject("adodb.connection")
conn.provider="microsoft.jet.oledb.4.0"团乱答
conn.open server.mappath("english.mdb")Set rs=server.CreateObject("adodb.recordset")
rs.open "select * from sentence",conn,1,1 '先读取全部记录max=rs.recordcount ‘读取最塌慧大记录数
For i=1 To 7 ’随机输出7个
randomize
id=Int(Rnd(now)*max+1) ‘定义从1到最大记录数之间的随机记录号
rs.absoluteposition=id ’定义记录集的陪扒绝对指针
Response.Write rs(0)&rs(1)&rs(2)
Next
%>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-12-04
展开全部
<%
function HTMLEncode(fstring)
fstring=replace(fstring,">",">")
fstring=replace(fstring,"<"知没,"<")
fstring=replace(fstring,CHR(32)," ")
fstring=replace(fstring,CHR(13),""举核)
fstring=replace(fstring,CHR(10)&CHR(10),"</p><p>")
fstring=replace(fstring,CHR(10),"<正猛掘br>")
HTMLEncode=fstring
end function
%>
function HTMLEncode(fstring)
fstring=replace(fstring,">",">")
fstring=replace(fstring,"<"知没,"<")
fstring=replace(fstring,CHR(32)," ")
fstring=replace(fstring,CHR(13),""举核)
fstring=replace(fstring,CHR(10)&CHR(10),"</p><p>")
fstring=replace(fstring,CHR(10),"<正猛掘br>")
HTMLEncode=fstring
end function
%>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-12-04
展开全部
“else
for dydesign=1 to 7” 没输出吗?
for dydesign=1 to 7” 没输出吗?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-12-04
展开全部
看不出你的代码要做什么,请完整写
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询