在Classic ASP页面上输出SQL查询

Dar*_*ook 0 asp-classic

我在经典的asp页面上运行以下查询.

sSQL = "Select ProductID, SUM(Quantity) FROM OrderDetails Where CAST(orderDate AS DATE) Between '"&sStartDate&"' And '"&sEndDate&"' GROUP BY ProductID"
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open sSQL, cnn, adOpenStatic, adLockReadOnly, adCmdText

<tr>
<td>
<%Response.Write(rs.Fields("ProductID"))%>
</td>
<td>
What is the code to get the sum of the quantity here?
</td>
Run Code Online (Sandbox Code Playgroud)

如何输出数量?

Jin*_*ain 6

sSQL = "Select ProductID, SUM(Quantity) as TotalQuantity FROM OrderDetails Where CAST(orderDate AS DATE) Between '"&sStartDate&"' And '"&sEndDate&"' GROUP BY ProductID"
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open sSQL, cnn, adOpenStatic, adLockReadOnly, adCmdText

<tr>
<td>
<%Response.Write(rs.Fields("ProductID"))%>
</td>
<td>
<%= rs.Fields("TotalQuantity") %>
</td>
Run Code Online (Sandbox Code Playgroud)