<%
rem ถ้าไม่มีค่าัวันที่ส่งมาก็ไม่ต้องทำงานต่อ
if sdat="" then response.end
Set conn = Server.CreateObject("ADODB.Connection")
sdat=month(sdat)&"/"&day(sdat)&"/"&year(sdat)
conn.open "DSN=DEMO;UID=sa"
sql="SELECT * FROM Table1 WHERE DDD = '" & sdat &"'"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql,conn,1,3
'rs.Open sql, conn
'response.write rs.RecordCount
%>
<table>
<TABLE BORDER="1" CELLPADDING="1" BORDERCOLOR="#C0C0C0" BGCOLOR="#FCF9D8" style="font-family: MS Sans Serif">
<TR>
<td>Temp1</td>
<td>Temp2</td>
<td>Temp3</td>
<td>Temp4</td>
<td>Date</td>
<td>Time</td>
</tr>
<% While Not Rs.EOF%>
<tr>
<td><%= Rs("Temp1")%></td>
<td><%= Rs("Temp2")%></td>
<td><%= Rs("Temp3")%></td>
<td><%= Rs("Temp4")%></td>
<td><%= Rs("DDD")%></td>
<td><%= Rs("TTT")%></td>
</tr>
<%
t1=t1+rs("temp1")
t2=t2+rs("temp2")
t3=t3+rs("temp3")
t4=t4+rs("temp4")
Rs.MoveNext
Wend
Set rsmax=Server.CreateObject("adodb.recordset")
sqlmax="select max(temp1) as max1, max(temp2) as max2, max(temp3) as max3, max(temp4) as max4 from Table1 where DDD = '" & sdat &"'"
Set rsmin=Server.CreateObject("adodb.recordset")
sqlmin="select min(temp1) as min1, min(temp2) as min2, min(temp3) as min3, min(temp4) as min4 from Table1 where DDD = '" & sdat &"'"