Click here to Skip to main content
13,299,727 members (59,649 online)
Rate this:
 
Please Sign up or sign in to vote.
hi guys ,
i designed my crystal Report and Make my stored procedure as it is data Source and link it to be showed in WPF Form this is the used code

ReportDocument rptdc = new ReportDocument();
CrystalReportViewer rptViewer = new CrystalReportViewer();
  string Str_FullPath; // the path of the report
  rptdc.Load(this.FullPath);
  rptdc.SetDatabaseLogon(Cls_Utility.UserName, Cls_Utility.PassWord, Cls_Utility.ServerName, Cls_Utility.DataBaseName);
  rptViewer.ReportSource = rptdc;
  this.reportviewer.Child = rptViewer;


we are a team of three Members it work fine on their PC Except Me Gives me a log in window to enter log in information how can i solve this problem ?

thanks in advanced
Posted 29-Sep-12 12:51pm
Comments
   
Not really a question, the problem is not explained.
--SA

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Hi,

Set the report credential like

 ReportDocument rptdc = new ReportDocument();
          CrystalReportViewer rptViewer = new CrystalReportViewer();
            string Str_FullPath; // the path of the report 
            rptdc.Load(this.FullPath);
           report.DataSourceConnections(0).SetConnection("Server", "Database", "UserName", "password");   
         rptViewer.ReportSource = rptdc;
            this.reportviewer.Child = rptViewer;
 


Thanks,
Adersh Ram BK
  Permalink  
Comments
yayaNasr 5-Oct-12 6:56am
   
thanks for your attention ... yes it work well with reports that have no Parameters and the problem still fired with reports that has parameters any solution for this ?
yayaNasr 5-Oct-12 7:29am
   
this is an Example :
/// <summary>
/// Load Report With Date Time NOW
///
public void LoadReportWitDateNow()
{
//string fullpath = System.IO.Path.GetFullPath("..\\..\\Reports\\Inventory\\SelectTotQtyForEveryMedInAllInventories.rpt");
rptdc.Load(this.FullPath);
rptdc.DataSourceConnections[0].SetConnection(Cls_Utility.UserName, Cls_Utility.PassWord, Cls_Utility.ServerName, Cls_Utility.DataBaseName);

#region ParameterField , s

ParameterField PF1 = new ParameterField(); // Creating the parameter field for the firs parameter
ParameterDiscreteValue PDV1 = new ParameterDiscreteValue(); // Creating discrete value for Parameter field one
DateTime dt= DateTime.Now;// add Value to discrete value
PDV1.Value = dt.ToString("MM/dd/yyyy");
PF1.ParameterFieldName = this.ParameterOne;// seting parameter name to parameter field as it found in Stored Procedure.
PF1.CurrentValues.Add(PDV1);// adding discrete value to parameter field
//====================== Creating ParameterFields ===========================================
ParameterFields PFS = new ParameterFields();
PFS.Add(PF1);

#endregion

rptViewer.ParameterFieldInfo = PFS;
rptViewer.ReportSource = rptdc;
this.reportviewer.Child = rptViewer;
}
Adersh Ram 8-Oct-12 9:46am
   
Hey,

Sorry for late reply !

Use:
rptdc.Setparameter("param name ","value");

I think it can help you.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web04 | 2.8.171207.1 | Last Updated 2 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100