连接字符串尚未初始化 [英] Connection string has not been initialized

查看:102
本文介绍了连接字符串尚未初始化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在研究dotnet图表并获取初始化连接字符串的错误



我尝试了什么:



Hi I am working on dotnet charting and getting error to initialize Connection String

What I have tried:

<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();
        }
       
    }
}

推荐答案

使用调试器查看 Chart.DefaultSeries.ConnectionString 变量的运行时值,并根据数据库设置进行检查。
Use the debugger to see the runtime value of Chart.DefaultSeries.ConnectionString variable and check it against your database settings.


这篇关于连接字符串尚未初始化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆