Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
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
Updated 31-Aug-18 2:32am

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
 
Share this answer
 
Comments
thatraja 30-Dec-11 3:54am    
You beat me to it, Take a 5!
Dineshkumar Ramakrishnan 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 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.
Dineshkumar Ramakrishnan 30-Dec-11 4:27am    
Hi Sathish,
Do u got my prob, am i clear to you?
bluesathish 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.

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,
C#
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,
 
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