我想獲得列的值的總和,爲此,我在我的select語句中使用SUM()。如何使用vbscript總結列的值
<%
sql = "select SUM(OpcCalEstQuantity) as qt_total from [Sheet1$] where cInt(JobEstimateNumber) = '"&cint(request.QueryString("no"))&"' and MccDescription = 'CTP Plate Making & Plates' and MaoOperationDescription = 'Plate Making'"
rs1.open sql, con, 1, 2
do while not rs1.eof
%>
<td style="padding:3px; text-align:right;"><%=rs1("qt_total")%></td>
<%
rs1.movenext
loop
rs1.close
%>
但我在瀏覽器上顯示時出現此錯誤。
Microsoft JET Database Engine error '80040e14'
Invalid use of Null
所以我認爲解決方法是用vbscript來計算值。但是沒有這樣的函數來計算列的值。
列'JobEstimateNumber '最有可能包含一個或多個NULL值。我手頭沒有解決方案,但我首先會問,爲什麼需要將列轉換爲整數,而不是將其作爲整數存儲在第一位。 –