| Using with Database and scripts > ASP.NET, MS SQL Server and dataXML Method |
Previously, we had seen how to use ASP.NET with dataURL method. Here, we'll see how to use FusionCharts with ASP.NET using dataXML method. As we had earlier seen, the dataXML method requires only one page:
Chart.aspx looks as under: |
| <%@ Import Namespace="System.Data"
%> <%@ Import Namespace="System.Data.SQLClient" %> <script runat="server"> 'Initialize a variable that will store FusionCharts XML Data document Dim strFCdataXML as String 'Year for which the data is to be shown Dim strSelectedYear as String Sub Page_Load(obj as Object, e as EventArgs) 'If coming for the first time, fill the select (drop down list) If Not IsPostBack Then 'Establish a connection Dim DS As DataSet Dim MyConnection As SqlConnection Dim MyCommand As SqlDataAdapter 'Get the list of years from the database. MyConnection = New SqlConnection(ConfigurationSettings.AppSettings("appDSN")) MyCommand = New SqlDataAdapter("SELECT DISTINCT YEAR(OrderDate) As Year FROM Orders ORDER BY 1", MyConnection) 'Fill
the dataset Public Function getFCXMLData() as String 'Fill the dataset |
| When you now view this chart, you'll get the following output: |
![]() |