cancel
Showing results for 
Search instead for 
Did you mean: 

Data-Set login prompt

Former Member
0 Kudos
106

Hello all,

                 I am trying to create reports using two data-tables in the dataset which is source for the designing of crystal report. I am using sqlexpress as database for our asp.net web application.

         But the the crystalReportViewer is asking for credentials of the database and my database dont have any user_id or password.

         The question is "Why it is asking for credentials? " and "Is there any default userId and password for database?" I am stuck with this from last 2 weeks. Please reply.

           Thank You...   

    

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

No need to be stuck for two weeks. Have you searched SCN? Find.sap.com? Lots and lots of info. Here are a few resources that should start you off:

KBA 1511438 - How to use datasets to pass data to crystal reports

Crystal Reports for Visual Studio .NET - Walkthrough - Reporting Off ADO.NET Datasets

Crystal Reports Guide To ADO.NET

Crystal Reports for Visual Studio 2005 Walkthroughs

Troubleshooting Issues with VS .NET Datasets and Crystal Reports - Business Intelligence (BusinessOb...

SAP Crystal Reports .NET SDK Developer Guide

SAP Crystal Reports .NET API Guide

As a tip for next time, specifying the version of .NET and CR should always be the 1st thing to do.

And to answer your question. The reason it is asking for credentials is because the dataset format does not match what the report is expecting. E.g.; a field in CR is defines as a string, in the dataset it is defined as a int (something like that).

- Ludek

Senior Support Engineer Product Support, Global Support Center Canada

Follow me on Twitter

Got Enhancement ideas? Use the SAP Idea Place

Former Member
0 Kudos

Thank you so much sir...

               I am using crystal report version 13_0_16 and .NET framework 4.0 with visual studio 2010 and the project is asp.net web application.

      As you suggested, I went through the resources. Now report is displaying data in the report viewer. But When that report is exported to any of the formats, That time the exported file is not containing the data. The file only contains the design of the report, If you want I can attach my code. Please reply.

          Thank you.

former_member183750
Active Contributor
0 Kudos

Omkar, how are you doing the export? Using the APIs or using the viewer button? Did you test the export with PDF and TXT file formats? Now, you are more than likely running into postback issues as if you are using the viewer button, this initiates a postback. Once that is done, unless the report is in a session, all db connectivity is lost. So have a look at this KBA re sessions:

1985571-  How to use sessions in web applications using the Crystal Reports viewer (the complete cod...

there is a  number of sample apps here:

Crystal Reports for .NET SDK Samples - Business Intelligence (BusinessObjects) - SCN Wiki

I would recommend having a look at the following samples:

  • vbnet_win_export.zip
  • vbnet_win_exporttopdf.zip

There have been issues with kinks to the KBAs so if it does not work, here is a copy of the solution:

public partial class Reports : RAPPBasePage

{

    private ReportDocument crReportDocument;

    protected override void Page_Init(object sender, EventArgs e)

    {

        //connect method to master event

        base.Page_Init(sender, e);

    }

    protected override void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load(sender, e);
        if (IsPostBack) // post back event, check if report is in session if it is view it.
        {
            crReportDocument = ReportDocument)Session["Report"];
            // Now send the report to the viewer
            CrystalReportViewer1.ReportSource = crReportDocument;
        }
    }

    protected void butReport_Click(object sender, EventArgs e)
    {
  // code based on customer's examples
  If(Session["Report"]==null) // Report is not in session (previously loaded) so load report, set params, view and place in session
  {
            crReportDocument = new ReportDocument();
            crReportDocument.Load(Server.MapPath("MyTestReport.rpt"));
            crReportDocument.SetDatabaseLogon("User", "Password", "Server", "Database");
            crReportDocument.SetParameterValue("LocationId", fwsuser.currentLocation);
            Session.Add(“Report”, crReportDocument);
   CrystalReportViewer.ReportSource = crReportDocument;
  }
  else // Report is already loaded and in session so use it also means we never reload the report
        {
            crReportDocument = (ReportDocument)Session["Report"];
   // Now send the report to the viewer
            CrystalReportViewer1.ReportSource = crReportDocument;         
        }
  //// How I would do it to so report is reloaded when ever button is pressed (IE Refreshing report, or load a different report if option

present)
  // crReportDocument = new ReportDocument();
        //  crReportDocument.Load(Server.MapPath("Report_To_Load"));
        //  crReportDocument.SetDatabaseLogon("UserID", "UserPassword", "ServerName", "DatabaseName");
        //  crReportDocument.SetParameterValue("LocationId", fwsuser.currentLocation);
        //  Session.Add(“Report”, crReportDocument);
  // CrystalReportViewer.ReportSource = crReportDocument;
    }

    protected void Page_UnLoad(object sender, EventArgs e)
    {
        try
        {
            crReportDocument.Close();
            crReportDocument.Dispose();
        }
       catch { }
    }

}

- Ludek

Message was edited by: Ludek Uher

Former Member
0 Kudos

Thank you sir for your response ,

           I got it worked from that.

          I am trying to generate subreports directly by using existing reports which I've created. But the problem is, I have used dataset for report which fills data into the report. And that dataset is filling in the code of the page.For example, If i want to generate a annual report of events organized in colleges. Which will have first page as summary page and from second page onwords one instace of event on one page.(event report data may vary events to events)

           If I want to fill subreport same as I have done. Is it possible? How? Please give me some references so i can generate such reports.

          Thank you in advance.

Answers (0)