Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I generated Crystal Report using Parameters and I am listing the Code below.
I am having Database Login Prompt Problem. Can I get the Solution for Database Login programatically.

C#
private void Form1_Load(object sender, EventArgs e)
 {
  crystalReportViewer1.ReportSource = ReportPath;
  CrystalDecisions.CrystalReports.Engine.ReportDocument objReport = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
  objReport.Load (ReportPath);
  ParameterField f1 = crystalReportViewer1.ParameterFieldInfo[0];
  ParameterDiscreteValue v1 = new ParameterDiscreteValue();
  v1.Value = Value to be passed;
  f1.CurrentValues.Add(v1);

  ParameterField f2 = crystalReportViewer1.ParameterFieldInfo[1];
  ParameterDiscreteValue v2 = new ParameterDiscreteValue();
  v2.Value = Value to be passed;
  f2.CurrentValues.Add(v2);
  }
Posted
Updated 15-Oct-11 7:24am
v3
Comments
Pravin Patil, Mumbai 15-Oct-11 12:51pm    
Can you elaborate on problems....?

 
Share this answer
 
Comments
RaviRanjanKr 16-Oct-11 16:58pm    
My 5 for Link.
theanil 17-Oct-11 1:05am    
Thank you :-)
Try this:

C#
objReport.SetDatabaseLogon("username", "pwd", "server", "database");


set the parameters according to your connection. This will remove Login prompt issue.

Or you can do this:

In Crystal Management Console (CMC) at each report level. Login to CMC, open ur report > Process > Database. At the bottom of the page u can specify "Prompt the user for database logon", "Use SSO context for database logon" or "Use same database logon as when report is run". Select the third option for using the credentials stored in the server.

And what is the problem in ReportTitle? please elaborate it.

hope it helps :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900