Telerik 报告:在设计时识别数据源时出现问题

发布于 2024-11-14 14:37:45 字数 1741 浏览 3 评论 0原文

我是 Telerik 报道的新手。我一直在尝试遵循这个 知识库文章,或多或少。

那里描述的方法绕过了向导。我需要绕过向导,因为数据库是 SQL Server 2000,而向导要求 2005 或更高版本。

我将 sqlDataAdapter 从工具箱拖放到报表中。该适配器是在报表的构造函数中配置的。

当我将文本字段添加到报告中并转到其属性页面并单击值的省略号 [...] 按钮并单击对话框左下部分中的“字段”时,右侧窗格显示“无数据源”。

如何让数据源在设计时被识别?我缺少什么?谢谢

namespace EventsReportingClassLibrary
{
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;
    using System.Data;
    using System.Data.SqlClient;
    using Telerik.Reporting;
    using Telerik.Reporting.Drawing;

    /// <summary>
    /// Summary description for Report1.
    /// </summary>
    public partial class Report1 : Telerik.Reporting.Report
    {

        private SqlConnection CNN;

        private SqlDataAdapter DA
        {
            get { return sqlDataAdapter1;  //  dropped from the toolbox onto report}
        }

        private string ConnectionString 
         {
                get { return "server=server5\\SQL2K;Initial Catalog=foo;User Id=foo2;Password=foo3;Pooling=yes"; }   
         }

        public Report1()
        {

            InitializeComponent();


           CNN = new SqlConnection(ConnectionString);          
           DA.SelectCommand = new SqlCommand("select * from myView",CNN);
            DA.SelectCommand.CommandType = CommandType.Text;
            this.DataSource = DA;
        }

        private void Report1_NeedDataSource(object sender, System.EventArgs e)
        {
          // fires at run-time if datasource of this report is null

        }


    }

}

I am new to Telerik reporting. I have been trying to follow this KB article, more or less.

The approach described there bypasses the Wizard. I need to bypass the Wizard because the database is SQL Server 2000 and the Wizard demands 2005 or later.

I drag and drop a sqlDataAdapter to the report from the Toolbox. The adapter is configured in the report's constructor.

When I add a text field to my report and go to its properties page and click on the ellipsis [...] button for Value and the click "Fields" in the lower left section of the dialog, the pane to the right says "No Data Source".

How to get the datasource to be recognized at design-time? What am I missing? Thanks

namespace EventsReportingClassLibrary
{
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;
    using System.Data;
    using System.Data.SqlClient;
    using Telerik.Reporting;
    using Telerik.Reporting.Drawing;

    /// <summary>
    /// Summary description for Report1.
    /// </summary>
    public partial class Report1 : Telerik.Reporting.Report
    {

        private SqlConnection CNN;

        private SqlDataAdapter DA
        {
            get { return sqlDataAdapter1;  //  dropped from the toolbox onto report}
        }

        private string ConnectionString 
         {
                get { return "server=server5\\SQL2K;Initial Catalog=foo;User Id=foo2;Password=foo3;Pooling=yes"; }   
         }

        public Report1()
        {

            InitializeComponent();


           CNN = new SqlConnection(ConnectionString);          
           DA.SelectCommand = new SqlCommand("select * from myView",CNN);
            DA.SelectCommand.CommandType = CommandType.Text;
            this.DataSource = DA;
        }

        private void Report1_NeedDataSource(object sender, System.EventArgs e)
        {
          // fires at run-time if datasource of this report is null

        }


    }

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文