How To connect to SQL Data Source in Web Report Designer

1 Answer 197 Views
Report Designer - Web
Radu
Top achievements
Rank 1
Radu asked on 29 Feb 2024, 07:39 PM

Hi to all,

I have an ASP .Net API ( NOT .NET Core ) web app and I want to connect to my database in web report designer through SQL Data Source in Report interface. My UI is ReactJS.

It works everything, I can save/load reports but I cannot add a valid SQL Data Source.

When I click SQL Data Source it gives me an error:

Error

t is not iterable


I tried to add a connection string in my Web.Config file 

 <add name="Telerik.Reporting.Examples.CSharp.Properties.Settings.TelerikConnectionString" 
connectionString="Data Source=<MY PRIVATE CONNECTION STRING>" 
providerName="System.Data.SqlClient"/>


But it doesn't work.

My code is 

  public class ReportDesignerController : ReportDesignerControllerBase
    {
        static ReportServiceConfiguration configurationInstance;
        static ReportDesignerServiceConfiguration designerConfigurationInstance;
        static ReportDesignerController()
        {
            //This is the folder that contains the report definitions
            //In this case this is the Reports folder
            var appPath = HttpContext.Current.Server.MapPath("~/");
            var reportsPath = Path.Combine(appPath, "Reports");
            //Add report source resolver for trdx/trdp report definitions,
            //then add resolver for class report definitions as fallback resolver;
            //finally create the resolver and use it in the ReportServiceConfiguration instance.
            var resolver = new UriReportSourceResolver(reportsPath);
            //Setup the ReportServiceConfiguration
            configurationInstance = new ReportServiceConfiguration
            {
                HostAppId = "Html5App",
                Storage = new FileStorage(),
                ReportSourceResolver = resolver,
                ReportSharingTimeout = 1000,
                ClientSessionTimeout = 20,
            };
            designerConfigurationInstance = new ReportDesignerServiceConfiguration
            {
                DefinitionStorage = new FileDefinitionStorage(reportsPath),
                SettingsStorage = new FileSettingsStorage(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Telerik Reporting"))
            };
        }
        public ReportDesignerController()
        {
            //Initialize the service configuration
            this.ReportServiceConfiguration = configurationInstance;
            this.ReportDesignerServiceConfiguration = designerConfigurationInstance;
             
        }
    }

1 Answer, 1 is accepted

Sort by
0
Momchil
Telerik team
answered on 05 Mar 2024, 11:49 AM

Hi Radu,

Both the connection string snippet and the ReportDesignerController configuration look correct to me.

When the SQL Data Source Wizard is opened, the Web Report Designer requests the available data connections, connection permissions, and data connection providers from its REST Service.

At this point I can only guess but, since you have already added a connection string, the error may be related to an empty/invalid response from the service for the data connection provider list. Can you send your project so that I can test it locally?

If not, please record the following logs and share them with me as they should contain valuable information.

If you do not want to risk exposing potentially sensitive information in the public thread, please share the logs in a new personal support ticket and add a reference to this thread.

Best Regards,
Momchil
Progress Telerik

Stay tuned by visiting our roadmap and feedback portal pages, enjoy a smooth take-off with our Getting Started resources, or visit the free self-paced technical training at https://learn.telerik.com/.
Tags
Report Designer - Web
Asked by
Radu
Top achievements
Rank 1
Answers by
Momchil
Telerik team
Share this question
or