Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
1.00/5 (1 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

C#
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
Comments
Sergey Alexandrovich Kryukov 1-Oct-12 0:55am    
Not really a question, the problem is not explained.
--SA

1 solution

Hi,

Set the report credential like

C#
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
 
Share this answer
 
Comments
Yasser El Shazly 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 ?
Yasser El Shazly 5-Oct-12 7:29am    
this is an Example :
///
/// 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)



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