Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
0 down vote favorite
share [fb] share [tw]

 
I have created my crystal report using command (sql query) in crytal report itself, by passing two parameters, i.e, say for eg:- Month & Year, While i preview the report, i can able to navigate through all pages by passing different parameters and its working fine, but while viewing the report through browser i can't able to view the current report instead is loads the previously generated report, but while i manually make refresh the crystal page in toolbar i can see the current report, even i can't navigate the current report . Can anyone help me on this..........
 
Thanks in advance.
Posted 29-Dec-11 19:32pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

hi dinesh,
You can refresh the report after each binding by adding the following code.
 crystalReportViewer.RefreshReport();
 
Hope this will help you.
 
Ref: http://msdn.microsoft.com/en-us/library/ms227086(v=vs.90).aspx[^]
 
Regards,
Bluesathish
  Permalink  
Comments
thatraja at 30-Dec-11 3:54am
   
You beat me to it, Take a 5!
Dinesh_Diny at 30-Dec-11 4:02am
   
Hi Sathish,
Thanks for your kind response. I tried with your suggestion but am getting error as "MISSING PARAMETER VALUES",
thanks....... any suggestions?
bluesathish at 30-Dec-11 4:07am
   
Hi dinesh,
"MISSING PARAMETER VALUES" means you didn't pass the parameter value which you created in your report. Just verify that every parameters have got their curresponding values at runtime.
Dinesh_Diny at 30-Dec-11 4:27am
   
Hi Sathish,
Do u got my prob, am i clear to you?
bluesathish at 30-Dec-11 4:52am
   
Hi dinesh,
Yes, I think you've to set the data source BEFORE you add the parameters. So First the set the datasource to the report and then set the parameters to pass.
 
Dinesh_Diny at 30-Dec-11 5:05am
   
Hi Sathish,
 
ok but,if i need to set datasource to the report before passing the parameter, where i should do it, b'coz i haven't passed any parameter from code behind. Or Can you able to provide me any code snippet to generate a parameterized report..
Thanks for your kind support!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi Sathish,
 
For more info,
 
I have created my crystal report by using the command in Database expert of crystal report and created my parameters there. I'm not talking parameters from code behind, even it throws error.
 
My code is,
public partial class Reports_MyCrystalReport: System.Web.UI.Page
{
 SqlConnection sqlCon = new SqlConnection(ConfigurationManager.AppSettings["MYAPP"]);
 ReportDocument objCrystalReport = new ReportDocument();
 
 string Username = ConfigurationManager.AppSettings["RptUserName"];
 string Password = ConfigurationManager.AppSettings["RptPassword"];
 
 protected void Page_Init(object sender, EventArgs e)
    {
        objCrystalReport.Load(Server.MapPath("MyCrystalReport.rpt"));
        objCrystalReport.SetDatabaseLogon(Username, Password, @"DATABASE 
        SERVER NAME", "DATABASE NAME");
        CrystalReportViewer1.ReportSource = objCrystalReport ;              
        CrystalReportViewer1.DisplayToolbar = true;
        CrystalReportViewer1.HasPrintButton = true;
        CrystalReportViewer1.HasCrystalLogo = false;
    }
 protected void Page_Unload(object sender, EventArgs e)
    {
        objCrystalReport.Close();
        objCrystalReport.Dispose();
    }
}
 
I'm a beginner working with crystal report, I'm not pretty sure whether the method i followed is right to create the crystal report, if i had made any wrong please help me on this. And suggest me the best way to achieve it..
 
Expecting your kind reply,
 
Thanks in advance,
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,382


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 30 Dec 2011
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