日期:2014-05-17 浏览次数:20882 次
dim nianyue, m, k, a(120),y,temp,temp1,dinghuo k=0 a(0)="2012-4-0" flag=0 SQLStr="SELECT 订货日 FROM 表1 WHERE 订货日 >= #2012-4-1# ORDER BY 订货日 ASC" Set rs3=Server.CreateObject("ADODB.Recordset") Set rs3=conn.execute(SQLStr) 'response.Write(rs3(0)) While NOT rs3.EOF IF NOT ISNULL(rs3("订货日")) THEN nianyue=YEAR(rs3("订货日"))& "-" & MONTH(rs3("订货日")) 'response.write(nianyue) & "<br>" FOR m=0 TO k temp=SPLIT(a(m),"-") IF temp(0) & "-" & temp(1) = nianyue THEN temp1=SPLIT(a(m),"-") a(m)=temp1(2) a(m)=a(m)+1 a(m)= nianyue & "-" & a(m) 'response.Write(a(m)) & "<br>" flag = 1 ' 找到了以前数组上有相同的月份 EXIT FOR end if NEXT '这个是新的月份,在以前的数组里没有找到过 if flag <> 1 then a(k+1)=1 a(k+1)=nianyue & "-" & a(k+1) 'response.write(a(k+1)) & "<br>" k=k+1 'response.Write("k=" & k) & "<BR>" end if END IF flag=0 rs3.movenext WEND dinghuo=0 for y=0 to k temp=split(a(y),"-") dinghuo=dinghuo+temp(2) next