黄斌是否结婚:谁能帮我设计一个简单的(ASP)程序

来源:百度文库 编辑:高考问答 时间:2024/05/04 18:56:11
数据库里的值

ID user pass time

会员ID 会员账号 会员密码 XXX-XXX-XXX

我每天都会添加一些会员,我想大家为我做一个读取的页面,列表显示,当天添加的就显示为红色,过后就显示为黑色.只做一个读取页面就行了,谢了
贴上来

<%strsql="select * from 表名 order by id desc"
rs.open strsql,conn,1,3
if not rs.eof then
do while not rs.eof
times=rs("time")
users=rs("user")
if times=date() then
colors=""
else
colors="#ff0000"
end if
end if
%>
<font color="<%response.write("colors")%>"><%response.write("users")%></font>
<%wend%>
建议:time作为数据库字段有时会出错,最好改一下.

<table>
<tr><td>user</td><td>time</td></tr>
<%
Dim objConn,objRS,strColor
Set objConn = Server.CreateObject("Adodb.Connection")
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("db.mdb")& ";"
Set objRS = objConn.Execute("SELECT * FROM table1")
Do Until objRS.Eof
If DateDiff("d", Now(), objRS("time")) = 0 Then strColor = " style=""color:red;""" else strColor = ""
Response.Write "<tr"& strColor &"><td>"& objRS("user") & "</td><td>"& objRS("time") &"</td></tr>"
Loop
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
%>
</table>

做好了怎么给你啊