预期语句VB错误输出XML

时间:2013-12-17 17:35:07

标签: xml vbscript asp-classic

我正在尝试从字符串构建XML文件,并且我收到了预期的语句错误。

我不知道是什么

错误会导致条形图的简单循环导致此错误。有什么想法吗?

提前致谢!布雷特

<%@ Language=VBScript %>

<%
Dim oConn, rs
Dim strConnQuery
Set oConn = Server.CreateObject("ADODB.Connection") 
oConn.Mode = 1
'Create the path to database
oConn.open session("DSN") 
%>

<%
'This page generates the XML data for the Chart contained in
'Default.asp.  

'Database Objects - Initialization
Dim oRs, oRs2, strQuery
'strXML will be used to store the entire XML document generated
Dim strXML

'Create the recordset to retrieve data
Set oRs = Server.CreateObject("ADODB.Recordset")


Function getTotals()
   'Initialize database objects
Dim oRs, strSQL
'Variable to store XML Data
Dim strXML
'To store categories
Dim strCat
'To store amount Dataset & quantity dataset

    Dim strAmtDS, strQtyDS
strCat = "select * from fusion_category"
strSQL = "select * from claim_table where reference_num =" & session("globalrefno")

Set oRs = Server.CreateObject("ADODB.Recordset")
oRs.Open strSQL, oConn

'Initialize <categories> element
strCat = "<categories>"
'Response.Write(strCat)
'Initialize datasets
strIncDS = "<dataset seriesname='Incurred'>"
strPdDS = "<dataset seriesName='Paid' parentYAxis='P'>"

'Variable to store link
Dim strLink  

'Iterate through each data row
Do While not oRs.EOF
strCat = strCat & "<category label='" & oRs("Category") & "'/>" 
strIncDS = strIncDS & "<set value='" & oRs("Incurred") & "'/>" 
strPdDS = strPdDS & "<set value='" & oRs("Paid") & "'/>"
'oRs.EOF

'Closing elements
strCat = strCat & "</categories>"
strIncDS = strIncDS & "</dataset>"
strPdDS = strPdDS & "</dataset>"

'Entire XML - concatenation
strXML =  strCat & strIncDS & strPdDS

oRs.Close()
Set oRs = nothing

getTotals = strXML

    End Function

strXML = "<chart caption='Incurred vs Paid" & getTotals() & "' xAxisName='Year' palette='" & "'                                              numberPrefix='$' formatNumberScale='0'>"
'Get the data
strXML = strXML & "<set label='Incurred' value='" & getTotals() & "' />"
strXML = strXML & "<set label='Paid' value='" & getTotals() & "' />"
strXML = strXML & "</chart>"

'Output it
Response.ContentType = "text/xml"
Response.Write(strXML)

%>

1 个答案:

答案 0 :(得分:1)

Do While not oRs.EOF

未关闭,所以

End Function

令人惊讶。

相关问题