Sign in to follow this  
missy786

Runtime Error Displaying The Graph

Recommended Posts

Dear all

 

I am using the free version of fusion charts db basic asp code and I am currently getting a runtime error on the highlighted code below:

 

<%@ Language=VBScript %>
<HTML>
  <HEAD>
     <TITLE>FusionCharts Free - Database Example</TITLE>
     <script LANGUAGE="Javascript" SRC="../../FusionCharts/FusionCharts.js"></SCRIPT>
  </HEAD>

  <!--#INCLUDE VIRTUAL="MyWeb/includes/FusionCharts.asp"-->
  'Adding library script that will connect to the Access Databse file automatically. 
  <!--#INCLUDE VIRTUAL="MyWeb/includes/DBConn.asp"-->
  <BODY>
  <CENTER>
  <%   
  'In this example, we show how to connect FusionCharts to a database.
  'For the sake of ease, we've used an Access database which is present in
  '../DB/FactoryDB.mdb. It just contains two tables, which are linked to each
  'other. 

  '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")

  'Generate the chart element
  strXML = "<graph caption='Factory Output report' subCaption='By Quantity' decimalPrecision='0' showNames='1' numberSuffix=' Units' pieSliceDepth='30' formatNumberScale='0'>"

  'Iterate through each factory
  strQuery = "select * from deal_price"
 [b] Set oRs = oConnection.Execute(strQuery)[/b]

  While Not oRs.Eof
     'Now create second recordset to get details for this factory
     Set oRs2 = Server.CreateObject("ADODB.Recordset")
     strQuery = "select sum(Quantity) as TotOutput from Factory_Output where FactoryId=" & ors("FactoryId")
     Set oRs2 = oConnection.Execute(strQuery) 
     'Generate <set name='..' value='..'/> 
     strXML = strXML & "<set name='" & ors("FactoryName") & "' value='" & ors2("TotOutput") & "' />"
     'Close recordset
     Set oRs2 = Nothing
     oRs.MoveNext
  Wend
  'Finally, close <chart> element
  strXML = strXML & "</chart>"
  Set oRs = nothing

  'Create the chart - Pie 3D Chart with data from strXML
  Call renderChart("../../FusionCharts/FCF_Pie3D.swf", "", strXML, "FactorySum", 650, 450)
%>
</BODY>
</HTML>

 

 

I can not figure out the reason behind this error and any help would be very much appreciated. Thank you for your time and help.

Share this post


Link to post
Share on other sites

Hi missy786,

 

Welcome to FusionCharts Forum :D

 

If this line:

Set oRs = oConnection.Execute(strQuery)

where you are getting the error, it seems that your ADO connection has not yet been established or you have created a wrong SQL query.

 

Probably, you are trying to use your own database and tables where as you might have connected to a different database (FusionCharts db may be).

 

Please check and modify DBConn.asp where you need to define your connection.

 

Also, this seems to be an issue with ASP and ADO. You can also check with external Classic ASP forums to get more help on the ASP related runtime error.

Share this post


Link to post
Share on other sites

Thank you so much for your response and help. I managed to resolve the runtime error, which was in database asp file, as you suggested. Thank you.

 

I currently have another problem, which does not display the chart on the webpage instead it is a blank screen.

 

I am using sql sever to create a basic pie chart and any help in this area would be very beneficial.

 

I really appreciate your time and help.

 

Thank you once again.

Edited by missy786

Share this post


Link to post
Share on other sites
Guest Sumedh

Hi,

 

Could you please check, if the JavaScript file path is correct? also check .SWF file path.

 

Did you get any error message while rendering the charts?

 

Can you please send us the browser console details with screen-shot?

Share this post


Link to post
Share on other sites

Hi,

 

Could you please check, if the JavaScript file path is correct? also check .SWF file path.

 

Did you get any error message while rendering the charts?

 

Can you please send us the browser console details with screen-shot?

 

Thank you so much for your response and help. I have provided details to my code and answer to your post on the following link:

 

http://forum.fusioncharts.com/topic/12658-blank-chart-webpage/

 

Thank you

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this