Last post Mar 20, 2014 04:41 AM by itityagi
Mar 20, 2014 03:07 AM|Kaviarasu|LINK
Hai, I'm using VS2010.
I have a problem in Crystal Report. I want to all records from database table and Display in Crystal Report.
I'm using the following coding for above that purpose, But it display only first row of the table. See my code,
<form id="form1" runat="server">
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server"
protected void Page_Load(object sender, EventArgs e)
txtID.Text = Session["ID"].ToString();
ReportDocument crystalReport = new ReportDocument();
std ds = GetData("select * from empdet");
CrystalReportViewer1.ReportSource = crystalReport;
private std GetData(string query)
SqlCommand cmd = new SqlCommand(query);
using (SqlConnection con = new SqlConnection("Data Source=SERVICETEAM-PC;Initial Catalog=example;User ID=sa;Password=kavi"))
using (SqlDataAdapter sda = new SqlDataAdapter())
cmd.Connection = con;
sda.SelectCommand = cmd;
using (std ds = new std())
Mar 20, 2014 03:31 AM|aspsak|LINK
Verify your dataset have all the records using breakpoit. Aslo use crystalReport.Refresh();
Verify your fields are in details section?
Mar 20, 2014 03:40 AM|itityagi|LINK
Have you checked, all the fields are in place on th report?
You have the proper dataset, also if the result is coming from the database?
Mar 20, 2014 04:27 AM|Kaviarasu|LINK
I checked all of that, but display only one record from the database table.
I have 5 Person(Person1,Person2,Person3,Person4 and Person5) records in my database table, But it display only the first row (Person1) record in database table...
Mar 20, 2014 04:41 AM|itityagi|LINK
checked all of that, but display only one record from the database table.
This record is shown in Report?
If Yes, then place the field objects or text objects(showing data from data table in report) in the detail section of the report, as there are sections like Page Header and Detail, Report Footer and page footer.
So place fields accordingly.