请高手帮助注释一段asp代码,有点难呀
Function getCumulativeSalesByCatXML(intYear,forDataURL)Dim oRsCat, oRs, strSQL
Dim strXML
Dim strCat, catXMLDone
catXMLDone = false
Dim strDataXML
strDataXML = ""
strCat = "<categories>"
strSQL = "Select categoryId,categoryName from FC_Categories GROUP BY categoryId,categoryName"
Set oRsCat = Server.CreateObject("ADODB.Recordset")
oRsCat.Open strSQL, oConn
Dim strLink
While not oRsCat.EOF
strDataXML = strDataXML & "<dataset seriesName='" & escapeXML(oRsCat("categoryName"),forDataURL) & "'>"
strSQL = "SELECT Month(o.orderdate) as MonthNum, g.CategoryID, g.CategoryName, round(sum(d.quantity),0) as quantity, SUM(d.quantity*p.Unitprice) As Total FROM FC_categories as g, FC_products as p, FC_orders as o, FC_OrderDetails as d WHERE year(o.OrderDate)=" & intYear &" and g.categoryId=" & oRsCat("CategoryId") & " and d.productid= p.productid and g.categoryid= p.categoryid and o.orderid= d.orderid GROUP BY g.CategoryID,g.categoryname,Month(o.orderdate)"
Set oRs = Server.CreateObject("ADODB.Recordset")
oRs.Open strSQL, oConn
While not oRs.EOF
if catXMLDone=false then
strCat = strCat & "<category label='" & MonthName(oRs("MonthNum"),true) & "' />"
end if
strLink = Server.URLEncode("javaScript:updateProductChart(" & intYear & "," & oRs("MonthNum") & "," & ors("CategoryId") & ");")
strDataXML = strDataXML & "<set value='" & oRs("Total") & "' link='" & strLink & "'/>"
oRs.MoveNext
Wend
catXMLDone = true
Set oRs = nothing
strDataXML = strDataXML & "</dataset>"
oRsCat.MoveNext()
Wend
strCat = strCat & "</categories>"
Set oRsCat = nothing
strXML = strCat & strDataXML
getCumulativeSalesByCatXML = strXML
End Function
特别是这个:
strSQL = "SELECT Month(o.orderdate) as MonthNum, g.CategoryID, g.CategoryName, round(sum(d.quantity),0) as quantity, SUM(d.quantity*p.Unitprice) As Total FROM FC_categories as g, FC_products as p, FC_orders as o, FC_OrderDetails as d WHERE year(o.OrderDate)=" & intYear &" and g.categoryId=" & oRsCat("CategoryId") & " and d.productid= p.productid and g.categoryid= p.categoryid and o.orderid= d.orderid GROUP BY g.CategoryID,g.categoryname,Month(o.orderdate)"