Chiranjeevi Aripaka

Chiranjeevi Aripaka

  • NA
  • 133
  • 303.7k

crystal reports is not displaying data

Apr 2 2018 3:36 AM
Dear Friends ,
 
Please help me in displaying data from database into the crystal report .
 
I have attached the complete code as a zip file
 
index.aspx
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Web;  
  5. using System.Web.UI;  
  6. using System.Web.UI.WebControls;  
  7. using System.Web.Configuration;  
  8. using System.Data;  
  9. using System.Data.SqlClient;  
  10. using System.IO;  
  11. using CrystalDecisions.CrystalReports.Engine;  
  12. using CrystalDecisions.ReportSource;  
  13. using CrystalDecisions.Reporting;  
  14. using CrystalDecisions.Shared;  
  15. public partial class index : System.Web.UI.Page  
  16. {  
  17. SqlConnection con = new SqlConnection(Class1.dbConnectionString);  
  18. SqlDataAdapter adap;  
  19. DataSet ds;  
  20. protected void Page_Load(object sender, EventArgs e)  
  21. {  
  22. }  
  23. protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)  
  24. {  
  25. }  
  26. protected void Button1_Click(object sender, EventArgs e)  
  27. {  
  28. con.Open();  
  29. SqlCommand cmd = new SqlCommand("BANKPROCEDURE", con);  
  30. cmd.CommandType = CommandType.StoredProcedure;  
  31. SqlDataAdapter da = new SqlDataAdapter(cmd);  
  32. //cmd.Parameters.AddWithValue("@BCODE", SqlDbType.Int).Value = DropDownList1.SelectedItem.Value.ToString();  
  33. DataTable ds = new DataTable();  
  34. ds.TableName = "BankDataSet1";  
  35. da.Fill(ds);  
  36. //GridView1.DataSource = ds;  
  37. //GridView1.DataBind();  
  38. ReportDocument rdoc = new ReportDocument();  
  39. rdoc.Load(Server.MapPath("BankCrystalReport.rpt"));  
  40. rdoc.SetDataSource(ds);  
  41. rdoc.SetParameterValue("CODE", Convert.ToInt32 ( DropDownList1.Text));  
  42. CrystalReportViewer1.ReportSource = rdoc;  
  43. CrystalReportViewer1.RefreshReport();  
  44. CrystalReportViewer1.DataBind();  
  45. con.Close();  
  46. }  
  47. }  
dbo.BANKPROCEDURE
  1. ALTER PROCEDURE dbo.BANKPROCEDURE  
  2. AS  
  3. SELECT * FROM BANK  
  4. RETURN  

Attachment: BANK_WEBSITE.zip

Answers (1)