Pooja kulkarni

Pooja kulkarni

  • NA
  • 13
  • 1.5k

Bind Crystal Reports with Dataset

Nov 1 2018 11:07 PM

I am having a form where I am updating data in my gridview and that updated gridview I want to save in one of the table on Save_Button_click; after that i want to generate report(crystal) for that sorted and updated data; there I got stuck ; Thanks in advance!

here is my query:

string StrAsset = "select * from tbl_Pre_Y1_Bus1,tbl_Pre_Y1_Bus_Master1_temp where tbl_Pre_Y1_Bus1.id='" + id + "' and tbl_Pre_Y1_Bus_Master1_temp.ID='" + ID + "')";
My Code:
{ 
dt
.Columns.Add(new System.Data.DataColumn("id", typeof(int)));
dt
.Columns.Add(new System.Data.DataColumn("PartNo", typeof(string)));
dt
.Columns.Add(new System.Data.DataColumn("ChallanDate", typeof(string)));
dt
.Columns.Add(new System.Data.DataColumn("ChallanNo", typeof(int)));
dt
.Columns.Add(new System.Data.DataColumn("sup_remark", typeof(string)));
dt
.Columns.Add(new System.Data.DataColumn("sup_status", typeof(string)));
dt
.Columns.Add(new System.Data.DataColumn("TMl_remark", typeof(string)));
dt
.Columns.Add(new System.Data.DataColumn("Tml_status", typeof(string)));
dt
.Columns.Add(new System.Data.DataColumn("Date_supp", typeof(string)));
dt
.Columns.Add(new System.Data.DataColumn("Sup_ins_name", typeof(string)));
dt
.Columns.Add(new System.Data.DataColumn("date_insp", typeof(string)));
dt
.Columns.Add(new System.Data.DataColumn("Inspectorname", typeof(string)));
} for (int i = 0; i < DSAsset.Tables[0].Rows.Count; i++)
{
dr
= dt.NewRow();
dr
[12] = DSAsset.Tables[0].Rows[i]["sup_remark"].ToString();
dr
[13] = DSAsset.Tables[0].Rows[i]["sup_status"].ToString();
dr
[14] = DSAsset.Tables[0].Rows[i]["TMl_remark"].ToString();
dr
[15] = DSAsset.Tables[0].Rows[i]["Tml_status"].ToString();
dr
[16] = DSAsset.Tables[0].Rows[i]["Date_supp"].ToString();
dr
[17] = DSAsset.Tables[0].Rows[i]["Sup_ins_name"].ToString();
dr
[18] = DSAsset.Tables[0].Rows[i]["date_insp"].ToString();
dr
[19] = DSAsset.Tables[0].Rows[i]["Inspectorname"].ToString();
dt
.Rows.Add(dr);
dt
.AcceptChanges();
 
}

aspx code:


<CR:CrystalReportViewer ID="CrystalReportViewer1" HasCrystalLogo="False" runat="server" 
AutoDataBind="true" ReportSourceID="CrystalReportSource1" DisplayGroupTree="False" EnableDatabaseLogonPrompt="False"
 EnableParameterPrompt="False" />
<CR:CrystalReportSource
ID="CrystalReportSource1" runat="server">
 <Report FileName="Dispatch.rpt"> </Report>
 </CR:CrystalReportSource>

 

Answers (4)