所以我对同一张表进行了两个查询。查询有效,但我的结果回来有点慢。我还使用了两个不同的变量(Shipment_D2 和 Count_D2) 有没有更好的方法来组合多个查询,同时使用不同的变量,而不是每次进行查询时都打开一个新连接?
<%
Set rscount11 = Server.CreateObject("ADODB.Recordset")
sql = "SELECT Count FROM DivisionNew WHERE JMS_UpdateDateTime >= DATEADD(day,-7, GETDATE()) AND
JMSDay = '" & smDateArray (Weekday(date)) &"' AND Section = 'D2' order by JMS_UpdateDateTime desc"
rscount11.Open sql, db
Count_D2 = rscount11 ("Count")
%>
<%
Set rscount12 = Server.CreateObject("ADODB.Recordset")
sql = "SELECT Shipment FROM DivisionNew WHERE JMS_UpdateDateTime >= DATEADD(day,-7, GETDATE()) AND
JMSDay = '" & smDateArray (Weekday(date)) &"' AND Section = 'D2' order by JMS_UpdateDateTime desc"
rscount12.Open sql, db
Shipment_D2 = rscount12 ("Shipment")
%>