Project SQL Data Sources: ConnectionString property has not been initialized

4 posts, 0 answers
  1. Michael
    Michael avatar
    4 posts
    Member since:
    Nov 2017

    Posted 11 Jun 2018 Link to this post

    Hi,

    I'm using Telerik Reporting Tools version 3.44.1.0 on Visual Studio 2017.

    I converted a few of my report parameter data sources from Current Data Sources to Report Data Sources by creating a class as described here (these are data sources that'll be used across multiple reports):

    https://docs.telerik.com/reporting/data-source-how-to-add-project-data-source.

    I used the Wizard to create the data source and the query works within the Wizard, but once I try to open the report I get the "ConnectionString property has not been initialized" error message.

    I've verified the connection string is present in the app.config and I was using the same connection string within the Current Data Sources.

    Example below:

    namespace ReportLibrary
    {
        public partial class ExchangeDateDataSource : Telerik.Reporting.SqlDataSource
        {
            private void InitializeComponent()
            {
                // 
                // ExchangeDateDataSource
                // 
                this.ConnectionString = "Reports.Properties.Settings.IOConnection";
                this.SelectCommand = "dbo.uspSelectExchangeRatesLkUp";
                this.SelectCommandType = Telerik.Reporting.SqlDataSourceCommandType.StoredProcedure;

            }
        }
    }

    Anything I'm doing wrong? Thanks.

  2. Todor
    Admin
    Todor avatar
    237 posts

    Posted 14 Jun 2018 Link to this post

    Hello Michael,

    The approach described in the article works correctly on our side. After creating a custom Project Data Sources and using it in a report, the report is rendered correctly, with no exceptions.

    The provided information is not enough to locate the problem.

    Make sure the InitializeComponent() method is called (this is not visible from the code snippet).

    Consider providing a step-by-step guide how to reproduce the problem.

    You can also open a support ticket and send us the entire class where the new component has been defined for local investigation.

    Regards,
    Todor
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Michael
    Michael avatar
    4 posts
    Member since:
    Nov 2017

    Posted 14 Jun 2018 in reply to Todor Link to this post

    I've created a ticket; I'll attach the report and classes to that ticket, but here's the step by step instructions on how I create the issue.

    1) Create a Project Data Source
    a) Create a new class object (.cs) file.
    b) Inherit the Telerik.Reporting..SqlDataSource object
    c) Rebuild the project and then right-click and view Designer.
    d) Click Configure Datasource.
    e) Choose Data Connection (choose existing data connection). We only have one connection string in the project
    f) Use as Shared Connection
    g) Select Statement or Stored Procedure and click Finished.

    2) Create a Report using a stored procedure that requires Parameters.

    a) Right-Click on the Report and choose Properties and click the ... next to "ReportParameters"

    b) In Report ParameterCollection Editor Add a New Parameter.

    c) Under AvailableValues->DataSource dropdown, choose the Project Data Source. This will create a new DataSource in (current datasource)

    d) Try previewing the report. This is where I get the error.

    (Note: if I recreate the parameter data source as a Current Data Source, rather than using the Project Data Source (following the wizard as above), it'll work fine.

  4. Todor
    Admin
    Todor avatar
    237 posts

    Posted 18 Jun 2018 Link to this post

    Hi Michael,

    You can find the answer in Ticket ID: 1172096 where we discuss the same questions. I suggest to continue our discussion there.

    For the benefit of our community I will include brief explanations also here:
    The Project Data Source classes need constructors where to call the InitializeComponent() method. For some reason they were not available in the provided classes.
    After adding constructors the issue was resolved on our side.

    Regards,
    Todor
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top