Cannot figure out data sources....

4 posts, 1 answers
  1. Daniel Corbett
    Daniel Corbett avatar
    24 posts
    Member since:
    Jun 2009

    Posted 10 Mar 2010 Link to this post

    what is the best way to troubleshoot when your datasource isn't working?

    The Fields in the datasource just don't show up when trying to access them.   I need to pull data from an Entity Framework data source.
    In the code below, I put everything into a simple class, like your Cars example.

    I have created an ObjectDataSource which uses the call to Submissions.GetSubmissions().   I have assigned this datasource to the Report and an embedded list   Everything compiles without errors, but when I try to set a textbox to a field value, I don't see any fields, I just see, "No datasource".

    I am using the newly released 2010 version of Telerik Reporting in Visual Studio 2008.

    Is there a walk through that I should be using?

       - Daniel

    using System;  
    using System.Collections;  
    using System.Collections.Generic;  
    using System.Configuration;  
    using System.Linq;  
    using System.Text;  
    using DatabaseLayer;  
    using log4net;  
    namespace PCIIReports  
        public class RSubmission  
            private Guid _submissionID;  
            private string _cikrName;  
            private string _cikrCountry;  
            private string _cikrState;  
            public RSubmission() { }  
            public RSubmission(Guid submissionId, String cikrName, string cikrCountry, string cikrState)  
                _submissionID = submissionId;  
                _cikrName = cikrName;  
                _cikrCountry = cikrCountry;  
                _cikrState = cikrState;  
            public Guid SubmissionId  
                get { return _submissionID; }  
                set { _submissionID = value; }  
            public String CIKRName  
                get { return _cikrName; }  
                set { _cikrName = value; }  
            public String CIKRCountry  
                get { return _cikrCountry; }  
                set { _cikrCountry = value; }  
            public String CIKRState  
                get { return _cikrState; }  
                set { _cikrState = value; }  
        public class Submissions  
            private static readonly ILog Log =  
            static string GetConnectionStringByName(string name)  
                // Assume failure.  
                string returnValue = null;  
                // Look for the name in the connectionStrings section.  
                ConnectionStringSettings settings =  
                // If found, return the connection string.  
                if (settings != null)  
                    returnValue = settings.ConnectionString;  
                return returnValue;  
            public Submissions()  
            public List<RSubmission> GetSubmissions()  
                var connectionString = GetConnectionStringByName("pciidbContext");  
                var context = new pciidbContext(connectionString);  
                var query =  
                    from submission in 
                    select new RSubmission  
                                   SubmissionId = submission.SubmissionId,  
                                   CIKRName = submission.CriticalInfrastructureKey == null ? "Unknown" : submission.CriticalInfrastructureKey.Name,  
                                   CIKRCountry = submission.CIKRCountry,  
                                   CIKRState = submission.CIKRStateAbbr  
                return query.ToList();  
  2. Daniel Corbett
    Daniel Corbett avatar
    24 posts
    Member since:
    Jun 2009

    Posted 11 Mar 2010 Link to this post

    Still having issues with this.

    I have learned that you can't grab the connection string easily using conventional means, and even using the means telerik recommended didn't seem to work with EntityConnections.  Now my connectionString is embedded in the code..    The code (an entity framework query) works from a unit test, but doesn't work when called from the designer, but I don't see the error message, and I'm not sure the best way for me to get that within the Visual Studio entvironment.

    The only error I get is:

      An error has occured while processing Table *:
      Exception has been thrown by the target of an invocation.

    Any clues?   I am not even utilizing the data returned by the query, this happens somewhere while trying to receive the query within the visual studio design time environment.


       - Daniel
  3. Answer
    Ivan avatar
    111 posts

    Posted 12 Mar 2010 Link to this post

    Hi Daniel Corbett,

    The reason you do not see the data source schema is probably because your business logic method throws an exception when it is called during design-time. The Data Explorer tool window suppresses the exception indicating only that there is no data source available at this time. After examining your code it appears that your method fails because ConfigurationManager cannot resolve the connection string correctly in design-time. More on this topic and a possible workaround can be found in the following KB article which discusses how to use connection strings from a configuration file.

    Sincerely yours,
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
  4. Adrian Segovia
    Adrian Segovia avatar
    9 posts
    Member since:
    Dec 2009

    Posted 24 May 2010 Link to this post

    Its seems you are having a similar problem.
    It turns out that static methods cannot be invoked from your business class (limitation of Telerik Reporting 2010 Q1). I would try making a call without using the static method GetConnectionStringbyName. Wrapping the static method is what I have been suggested to do but I have not figured it out how to wrap a static method yet.


Back to Top