Hi everyone!
when i fetch records from database and bind dataset....
dataset contain records but not showing in sap crystal report on vs 2012
not arise any error........... but not showing cry rpt.
can anyone help me ?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sanjay KumarPosted Aug 6, 2014, 8:54 AM
try this
ReportDocument rpt = new ReportDocument();
rpt.Load(Server.MapPath("~/CrystalReport.rpt"));
rpt.SetDataSource(dt);
CrystalReportViewer1.ReportSource = rpt;
CrystalReportViewer1.DataBind();
CrystalReportViewer1.RefreshReport();
Ravi KumarPosted Aug 6, 2014, 8:43 AM
con.open();
da = new SqlDataAdapter("select top 20 [DIST_NM],[YEAR_NM],[SCM_NM],[HEAD_NM],[ARG_AREA] from VIEW_LANDUSES_DTLS", con);
ds = new DataSet();
da.Fill(dt);
CrystalReport rd = new CrystalReport();
rd.Load(@"\\Reports\\CrystalReport.rpt"));
rd.SetDataSource(dt);
CrystalReportViewer1.ReportSource = rd;
con.Close();
Niranjan PoddarPosted Aug 6, 2014, 8:28 AM
but
not display crystal report...............
Ravi KumarPosted Aug 6, 2014, 8:19 AM
rd.SetDataSource(dsl.Tables[0]);
replace
rd.SetDataSource(dsl.Tables[0].DefaultView);
Niranjan PoddarPosted Aug 6, 2014, 8:06 AM
after create a crystal report and add columns into crystal report.
then create report page and take a reportviewer...
Page load() page codding here......................
protected void Page_Load(object sender, EventArgs e)
{
GetLandUses();
}
public void GetLandUses()
{
if (con.State == ConnectionState.Open)
{
con.Close();
}
con.Open();
da = new SqlDataAdapter("select top 20 [DIST_NM],[YEAR_NM],[SCM_NM],[HEAD_NM],[ARG_AREA] from VIEW_LANDUSES_DTLS", con);
ds = new DataSet();
da.Fill(ds);
dt = new DataTable();
dt = ds.Tables[0];
ReportDocument rd = new ReportDocument();
DsLandUse dsl = new DsLandUse();
DataTable dt1 = new DataTable();
dt1.TableName = "Crystal Report Example";
dsl.Tables[0].Merge(dt);
rd.Load(Server.MapPath("~/Reports/CrystalReport.rpt"));
rd.SetDataSource(dsl.Tables[0]);
CrystalReportViewer1.ReportSource = rd;
con.Close();
}
Ravi KumarPosted Aug 6, 2014, 7:58 AM