Dim Conn,strSQL1,objRec1,strSQL2,objRec2
Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "Driver={SQL Server};Server=IWEMC\CANONMGMTCONSOLE;Database=iWEMC;UID=sa;PWD=;"
strSQL1 = "SELECT McapTaskResultID,Counter1 FROM [iWEMC].[dbo].[McapRetrievedData] WHERE McapTaskResultID = (select max(McapTaskResultID) FROM [iWEMC].[dbo].[McapRetrievedData]); "
strSQL2 = "SELECT McapTaskResultID,Counter1 FROM [iWEMC].[dbo].[McapRetrievedData] WHERE McapTaskResultID = (select max(McapTaskResultID -1) FROM [iWEMC].[dbo].[McapRetrievedData]); "
Set objRec1 = Server.CreateObject("ADODB.Recordset")
Set objRec2 = Server.CreateObject("ADODB.Recordset")
objRec1.Open strSQL1, Conn, 1,3
objRec2.Open strSQL2, Conn, 1,3
%>
<%
While Not objRec1.EOF
%>
อ่านวันนี้ : <%=objRec1.Fields("Counter1").Value%><br>