ASP怎么根据日期来显示不同的价格?
来源:百度知道 编辑:UC知道 时间:2024/05/19 18:32:22
下订单的时候,有可能连续在9月25日到10月5日每天都要买10个..怎么根据这个不同日期来获取这次订单的最终价格呢?
越详细越好,我不是很明白,请各位不吝赐教.谢谢了.
源码:
<%
dim conn,connstr,time1,time2,time3,sql,price
on error resume next
Connstr="DRIVER=Microsoft Access Driver (*.mdb);DBQ="+server.mappath("data.mdb") '连接数据库,根据实际情况修改,如果有coon.asp的话,include一下,这段可以删去
Set Conn=Server.CreateObject("ADODB.Connection")
conn.Open connstr
If Err Then
err.Clear
Set Conn = Nothing
Response.Write "数据库连接出错,请检查连接字串。"
Response.End
End If
'定义日期
time1=cdate("2007-10-1 0:0:0") '10月1日
time2=cdate("2007-10-8 0:0:0") '10月7日
time3=cdate("2007-10-16 0:0:0") '10月15日
price=0 '价格
sql="select num,datenow from table1" 'sql查询 num是订货数量 datenow 是订货时间 table1是表名 可根据自己实际情况修改
set rs=conn.execute(sql)
do while not rs.eof
datenow=rs("datenow")
num=rs("num")
if datenow<time1