Click here to Skip to main content
Rate this: bad
good
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
Sergey Alexandrovich Kryukov at 1-Oct-12 0:55am
   
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 at 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 at 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 at 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
0 Sergey Alexandrovich Kryukov 289
1 DamithSL 225
2 OriginalGriff 175
3 Peter Leow 150
4 Afzaal Ahmad Zeeshan 95
0 OriginalGriff 7,355
1 DamithSL 5,254
2 Sergey Alexandrovich Kryukov 4,942
3 Maciej Los 4,906
4 Kornfeld Eliyahu Peter 4,514


Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 2 Oct 2012
Copyright © CodeProject, 1999-2014
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