CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2010
    Posts
    5

    Unhappy C# and Crystal Report

    Hi C#Sharp and Crystal Report Guru,

    Please help or guide me on my problem regarding passing a datasource to crystal report.

    Scenario:
    Crystal Report files are created and pointed to a Database View (ie VW_DATA)

    Problem:
    Using CrystalReportViewer and ReportDocument, how to dynamically point a ReportDocument to use different database VIEW aside from using the VW_DATA?


    Please help me on this one.


    Thanks heaps Gurus!


    Student,
    Kiko

  2. #2
    Join Date
    Jul 2005
    Location
    Louisville, KY
    Posts
    201

    Resolved Re: C# and Crystal Report

    I hope this will be of some help to you, please visit this site, and let me know if it helps! I'm not too familiar with Crystal Reports, but if you ever have any questions regarding SQL Server Reporting Services (SSRS) as a Crystal Reports alternative, feel free to message me.

    Regards,
    Quinn

    If this helps, please rate up!

  3. #3
    Join Date
    Dec 2010
    Posts
    5

    Re: C# and Crystal Report

    thanks for the reply quinn. i will check on the site.

    regards,
    kiko

  4. #4
    Join Date
    Dec 2010
    Posts
    5

    Re: C# and Crystal Report

    hi quinn,

    the solution on the site didn't worked. the ReportDocument is still pointing on the view which was used during during the design time.


    regards,
    kiko

  5. #5
    Join Date
    Dec 2010
    Posts
    5

    Re: C# and Crystal Report

    to add further info, is there a way to dynamically change the table.LogOnInfo.TableName ?

    ie:
    Code:
    table.LogOnInfo.TableName = "dynamic view or tablename"

  6. #6
    Join Date
    Jul 2005
    Location
    Louisville, KY
    Posts
    201

    Re: C# and Crystal Report

    Quote Originally Posted by kikoph View Post
    to add further info, is there a way to dynamically change the table.LogOnInfo.TableName ?

    ie:
    Code:
    table.LogOnInfo.TableName = "dynamic view or tablename"
    In leiu of that question, from that link I gave,

    Code:
    private void AssignConnectionInfo(ReportDocument document,ConnectionInfo crConnection)
        {
            foreach (CrystalDecisions.CrystalReports.Engine.Table table in document.Database.Tables)
            {
                TableLogOnInfo logOnInfo = table.LogOnInfo;
                if (logOnInfo != null)
                {
                    table.ApplyLogOnInfo(table.LogOnInfo);
                    table.LogOnInfo.TableName = table.Name;
                    table.LogOnInfo.ConnectionInfo.UserID = crConnection.UserID;
                    table.LogOnInfo.ConnectionInfo.Password = crConnection.Password;
                    table.LogOnInfo.ConnectionInfo.DatabaseName = crConnection.DatabaseName;
                    table.LogOnInfo.ConnectionInfo.ServerName = crConnection.ServerName;
    
                    CrystalReportViewer1.LogOnInfo.Add(table.LogOnInfo);
    
                }
            }
        }
    Apparently, according to http://msdn.microsoft.com/en-us/libr...(v=vs.80).aspx, that TableName is just passed as a "String*".
    Last edited by QuinnJohns; October 12th, 2011 at 11:03 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured