Sign in to follow this  
eilob

Visual studio (C# and ASP.net)

Recommended Posts

Hi, I am working with Fusion charts and visual studio, I was reading the instructions to develop a website, were it says that we must place the folder on the root directory of the application, I added it as a new item to my Visual studio application. Then I was trying to do the DBExample on the  example on FusionCharts_EvaluationCodeC# folder, and is giving me two errors, one is doesnt recognise the FusionChart variable at the end of the code and then doesnt recognised the DBHelper.Connection

Any advise?, please find attached the code I am using and let me know if I am going in the correct direction... Thanks a lot! eilob

using System;

using System.Data;

using System.Configuration;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using System.Data.OleDb;

using System.Data.Odbc;

public partial class _Default : System.Web.UI.Page

{

  protected void Page_Load(object sender, EventArgs e)

  {

  }

  public string GetFactorySummaryChartHtml()

  {

  //xmlData will be used to store the entire document generated

  string xmlData;

  //Generate the chart element

  xmlData = "<chart caption='Mailbox' subCaption='By Quantity' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' Units'>";

 

  //Iterate through each factory

  string factoryQuery = "select * from mailbox";

  using (OdbcConnection connection = DBHelper.Connection(DBHelper.ConnectionStringFactory))

  {

  using (OdbcCommand factoryCommand = new OdbcCommand(factoryQuery, connection))

  {

  using (OdbcDataAdapter adapter = new OdbcDataAdapter(factoryCommand))

  {

  DataTable table = new DataTable();

  adapter.Fill(table);

  foreach (DataRow row in table.Rows)

  {

  string quantityQuery = "select sum(Quantity) as TotOutput from Factory_Output where FactoryId=" + row["FactoryId"].ToString();

  using (OdbcCommand quantityCommand = new OdbcCommand(quantityQuery, connection))

  {

  xmlData += "<set label='" + row["FactoryName"].ToString() + "' value='" + quantityCommand.ExecuteScalar().ToString() + "' />";

  }

  }

  }

  }

  connection.Close();

  xmlData += "</chart>";

  }

  //Create the chart - Pie 3D Chart with data from xmlData

  return FusionCharts.RenderChart("C:/Documents and Settings/obroie1/Desktop/Charts/FusionCharts/Pie3D.swf", "", xmlData, "FactorySum", "600", "300", false, false);

  }

  }

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