Load Report Failed
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Thread: Load Report Failed

  1. #1
    Join Date
    Oct 2008
    Posts
    1

    Load Report Failed

    Hello experts,

    I am developing a windows application in .net (C#, Visual Studio 2005, Crystal Reports for Visual Studio 2005).

    I have problem with crystal reports, when i try to show the report, it gives me the message box "Load Report Failed" and then prompts for parameters to be enter.

    This is random behavior, the problem may occur first time, some times it works for 14 - 20 attempts and then generates the error message.

    I am using Crystal Report Viewer model.

    I tried a lot to resolve it but unfortunatelly failed.


    Please help me.

    The code is like this.


    string reportPath = Application.StartupPath + "\\Reports\\" + RptName;

    ReportViewer.ParameterFieldInfo = null;
    ReportViewer.ReportSource = reportPath;


    // Assigning parameter values
    ParameterFields parameters = ReportViewer.ParameterFieldInfo;

    ParameterField fromDate = parameters["FROM_DATE"];
    ParameterValues currentValues = new ParameterValues();
    ParameterDiscreteValue descritValue = new ParameterDiscreteValue();


    descritValue.Value = dtFrom.Value;
    currentValues.Add(descritValue);
    fromDate.CurrentValues.Clear();
    fromDate.CurrentValues = currentValues;

    ParameterField todate = parameters["TO_DATE"];
    currentValues = new ParameterValues();
    descritValue = new ParameterDiscreteValue();

    descritValue.Value = dtTo.Value;
    currentValues.Add(descritValue);
    todate.CurrentValues.Clear();
    todate.CurrentValues = currentValues;



    ConnectionInfo connectionInfo = new ConnectionInfo();
    connectionInfo.DatabaseName = "TEST";
    connectionInfo.UserID = "sa";
    connectionInfo.Password = "sa";
    connectionInfo.ServerName = serverName;



    SetDBLogonForReport(connectionInfo);
    connectionInfo = null;



    private void SetDBLogonForReport(ConnectionInfo connectionInfo)
    {
    TableLogOnInfos tableLogOnInfos = ReportViewer.LogOnInfo;
    foreach (TableLogOnInfo tableLogOnInfo in tableLogOnInfos)
    {
    tableLogOnInfo.ConnectionInfo = connectionInfo;
    }
    }
    Last edited by ghanshyamsonara; October 11th, 2008 at 06:39 AM.

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center