Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi I am working on dotnet charting and getting error to initialize Connection String

What I have tried:

C#
<pre>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Drawing.Drawing2D;
using dotnetCHARTING;
using System.Configuration;



namespace dotnetdrilldown03
{
    public partial class Drilldown4 : System.Web.UI.Page
    {
        
        protected void Page_Load(object sender, EventArgs e)
        {
            Chart.DefaultSeries.ConnectionString = ConfigurationManager.AppSettings["sqlconnection"];
            Chart.Title = "Item sales";
            Chart.XAxis.Label.Text = "Years";
           // Chart.TempDirectory = "temp";
            Chart.Debug = true;

            Chart.DateGrouping = TimeInterval.Years;
            Chart.DrillDownChain = "Years,Quarters,Months,days=Days,hours,minutes,seconds";

            Chart.DefaultSeries.DefaultElement.ToolTip = "%yvalue";

            
            Chart.SeriesCollection.Add();
            Chart.Series.Name = "Items 1";
            Chart.Series.StartDate = new System.DateTime(2016, 1, 1, 0, 0, 0);
            Chart.Series.EndDate = new System.DateTime(2016, 12, 31, 23, 59, 59);
            Chart.Series.SqlStatement = @"SELECT Duration,Sum(Total) FROM Report  WHERE Duration >= #STARTDATE# AND OrderDate <= #ENDDATE#  GROUP BY Report.Duration";

            Chart.SeriesCollection.Add();
        }
       
    }
}
Posted
Updated 2-Mar-17 22:49pm
Comments
Karthik_Mahalingam 3-Mar-17 4:51am    
asp chart or third party?
Member 12605293 3-Mar-17 4:56am    
Hi Karthik
aspchat with dotnet prefix
Richard MacCutchan 3-Mar-17 7:17am    
The debugger will immediately show you what is wrong. Check the spelling of your attribute.

1 solution

Use the debugger to see the runtime value of Chart.DefaultSeries.ConnectionString variable and check it against your database settings.
 
Share this answer
 
Comments
Member 12605293 3-Mar-17 4:55am    
Hi Pallini
I am using sqlserver and it is showing DataProviderType = OleDb

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900