兄弟 我对你很无语 刚看到 csdn你也发帖了 我是潜水王 对你无语啊 ,多简单的问题啊,
你select 列数据的时候 用 时间排序就好
你select 列数据的时候 用 时间排序就好
Dim Db,Conn Db = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("01.mdb") Set Conn = Server.CreateObject("ADODB.Connection") Conn.open Db 'lid 开始id 'rid 结束id lid = 1 rid = 7 Lyear = FormatDateTime(now(),2) '日期如果也加段的话自己搞吧,照葫芦画瓢 '小时 时间段 按照时间规则 24以内 最好在最好不要超过 22,因为有随机的+59秒所以可能产生日期+1天的可能 LHour = "9-20" '按照时间规则 60以内 最好在最好不要超过 58,因为有随机的+59秒所以可能产生日期+1天的可能 Lminute = "1-58" Call SetDate(lid,rid,Lyear,LHour,Lminute) '打开数据库自己加 Function GetDate(Lyeara,LHoura,Lminutea) Dim L_Hour,LHT_Hour,LHour_l,LHour_r,LHourb Dim L_minute,LHT_minute,Lminute_l,Lminute_r,Lminuteb,Lsecondb Randomize 'Response.write LHour_r L_Hour = Split(LHoura, "-", -1, 1) LHT_Hour = L_Hour LHour_l = Int(L_Hour(1))-Int(L_Hour(0))+1 LHour_r = Int(L_Hour(0)) LHourb = Int((LHour_l * Rnd)+LHour_r) L_minute = Split(Lminutea, "-", -1, 1) LHT_minute = L_minute Lminute_l = Int(L_minute(1))-Int(L_minute(0))+1 Lminute_r = Int(L_minute(0)) Lminuteb = Int((Lminute_l * Rnd)+Lminute_r) Lsecondb = Int((59 * Rnd) + 1) GetDate = FormatDateTime(Lyeara&" "&LHourb&":"&Lminuteb&":"&Lsecondb) 'Response.write "<br><font color=red>时间段:"&FormatDateTime(Lyear&" "&LHT_Hour(0)&":"&LHT_minute(0)&":00")&"至"&FormatDateTime(Lyear&" "&LHT_Hour(1)&":"&LHT_minute(1)&":00")&"</font>" End Function Function SetDate(lid,rid,Lyear,LHour,Lminute) Dim Sql,Rs,Total,ydate Dim LLHour,LLminute Randomize 'LLHour = LHour 'LLminute = Lminute Set Rs = Server.Createobject("adodb.recordset") Total = 0 Sql = "select id,ydate from Table_1 where id >= "&lid&" and id <= "&rid 'Response.write sql Rs.Open Sql,Conn,1,1 If Rs.Bof Or Rs.Eof Then 'Response.write "False" Else Do Until Rs.EOF '随机根据当前时间生成时间,加(1-59)秒随机数,可以换分钟,小时 ydate = GetDate(Lyear,LHour,Lminute) ydate = DATEADD ("s" , Int((59 * Rnd) + 1),ydate) BHour = FormatDateTime(ydate,3) AHour = Split(LHour, "-", -1, 1) BHour = Split(BHour, ":", -1, 1) Aminute= Split(Lminute, "-", -1, 1) LHour = BHour(0)&"-"&AHour(1) Lminute = BHour(1)&"-"&Aminute(1) '当每超过三条数据的时候判断 If (Total Mod 3)=0 Then '每3条+1天 If Total <> 0 Then ydate = DATEADD ("d" , 1, ydate) Lyear = FormatDateTime(ydate,2) Total = 0 'LHour = LLHour 'Lminute = LLminute 'Else 'LHour = BHour(0)&"-"&AHour(1) 'Response.Write LHour 'ydate = End If End If Response.write "<br>ID:"&Rs("id")&" 更新时间:"&ydate&"<br>" Sql = "Update Table_1 Set ydate='"&ydate&"' Where id="&Rs("id") 'Response.write Sql Conn.Execute(Sql) Total=Total+1 Rs.MoveNext Loop End If Rs.Close Set Rs = Nothing 'Response.write "True" End Function '关闭数据库自己加 Conn.Close Set Conn = Nothing