protected void Button5_Click(object sender, EventArgs e)
{
con = new SqlConnection("Server=(local);initial catalog=master;Trusted_Connection=True");
con.Open();
string str = "select * from Empdet where EmployeeID='" + DropDownList1.SelectedValue + "'";
SqlCommand com = new SqlCommand(str, con);
SqlDataAdapter sqlda = new SqlDataAdapter(com);
DataSet ds = new DataSet();
sqlda.Fill(ds, "Empdet");
con.Close();
ReportDocument r1 = new ReportDocument();
//r1.Load("Full Path of Your Report\Employee.rpt");
string path = Server.MapPath("Reports/Employee.rpt");
r1.Load(path);
r1.SetDataSource(ds);
CrystalReportViewer1.ReportSource = r1;
CrystalReportViewer1.RefreshReport();
}
When i run all the employee details are appear in the run mode.
Textbox Button.
in textbox i type the partiuclar employee id and click the button the following error occurs as follows Load Report Failed.
Neha SharmaPosted Oct 20, 2012, 3:27 AM
The "Load Report failled" is the only problem i guess just because of wrong path for the Crystal report to open,please debug your code and check the path in your localhost.
This method ll help you.
If it helps you mark it as answer.