WebRoot/FusionChartsFree/Code/VBNET/DB_JS/Default.aspx.vb

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

Imports DataConnection
Imports InfoSoftGlobal
Partial Class DB_JS_Default
    Inherits System.Web.UI.Page
    Public jsVarString As String
    Public indexCount As String
    Public Sub GetjsVar()

        'In this example, we show a combination of database + JavaScript rendering using FusionCharts.

        'The entire app (page) can be summarized as under. This app shows the break-down
        'of factory wise output generated. In a pie chart, we first show the sum of quantity
        'generated by each factory. These pie slices, when clicked would show detailed date-wise
        'output of that factory.

        'The XML data for the pie chart is fully created in ASP at run-time. ASP interacts
        'with the database and creates the XML for this.
        'Now, for the column chart (date-wise output report), we do not submit request to the server.
        'Instead we store the data for the factories in JavaScript arrays. These JavaScript
        'arrays are rendered by our ASP Code (at run-time). We also have a few defined JavaScript
        'functions which react to the click event of pie slice.

        'We've used an Access database which is present in ../DB/FactoryDB.mdb. 
        'It just contains two tables, which are linked to each other. 

        'Before the page is rendered, we need to connect to the database and get the
        'data, as we'll need to convert this data into JavaScript variables.

        'The following string will contain the JS Data and variables.
        'This string will be built in ASP and rendered at run-time as JavaScript.

        jsVarString = ""

        'Database Objects
        Dim oRs As DbConn, strQuery As String
        indexCount = 0

        'Iterate through each factory
        strQuery = "select * from Factory_Master"
        oRs = New DbConn(strQuery)

        While oRs.ReadData.Read()
            indexCount = indexCount + 1

            'Create JavaScript code to add sub-array to data array
            'data is an array defined in JavaScript (see below)
            'We've added vbTab & vbCRLF to data so that if you View Source of the
            'output HTML, it will appear properly. It helps during debugging
            jsVarString = jsVarString & vbTab & vbTab & "data[" & indexCount & "] = new Array();" & vbCrLf

            'Now create second recordset to get date-wise details for this factory
            strQuery = "select * from Factory_Output where FactoryId=" & oRs.ReadData("FactoryId").ToString() & " order by DatePro Asc" & vbCrLf
            Dim oRs2 As New DbConn(strQuery)
            While oRs2.ReadData.Read()
                'Put this data into JavaScript as another nested array.
                'Finally the array would look like data[factoryIndex][i][dataLabel,dataValue]
                jsVarString = jsVarString & vbTab & vbTab & "data[" & indexCount & "].push(new Array('" & Convert.ToDateTime(oRs2.ReadData("DatePro")).ToString("dd") & "/" & Convert.ToDateTime(oRs2.ReadData("DatePro")).ToString("MM") & "'," & oRs2.ReadData("Quantity").ToString() & "));" & vbCrLf

            End While
            'Close recordset
后面还有 51 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。