How to generate this crystal reports..

Posted by Sathiya_Narayanan under ASP.NET on 3/30/2012 | Points: 10 | Views : 988 | Status : [Member] | Replies : 4
I 'm generating crystal report its working
my requirement is, only particular data's to be display in the report there i 'm passing sql query
but it displays full dataset, it not short listed according to the given query

for me it should display only particular data and that data alone to be export to pdf

how to complete this task


protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = null;
con = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString);
SqlDataAdapter da = new SqlDataAdapter("select * from test where batch='" + DDL2.SelectedItem.Text + "'and month='" + DDL1.SelectedItem.Text + "'",con);
DataSet ds = new DataSet();
da.Fill(ds);
ReportDocument rptdoc = new ReportDocument();
rptdoc.Load(Server.MapPath("~/crystalreport3.rpt"));
rptdoc.SetDataSource(ds.Tables[0]);
CrystalReportViewer1.ReportSource = rptdoc;
CrystalReportViewer1.DataBind();
CrystalReportViewer1.RefreshReport();

}

SATHIYANARAYANAN


Responses

Posted by: Rajni.Shekhar on: 3/30/2012 [Member] Bronze | Points: 25

Up
0
Down
in crystal report add parameter or formula field and pass DDL2.SelectedItem.Text and DDL1.SelectedItem.Text in your formula or parameter field.

Thanks,
Rajni Shekhar

Sathiya_Narayanan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sathiya_Narayanan on: 3/30/2012 [Member] Starter | Points: 25

Up
0
Down
Hi i understand your explanation, i dono how to implement it..
i m new to .net technology, so please can you tell me further process how to implement,
if have any examples or samples pls give the link

SATHIYANARAYANAN

Sathiya_Narayanan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rajni.Shekhar on: 3/30/2012 [Member] Bronze | Points: 25

Up
0
Down
check link

http://forums.asp.net/t/1061317.aspx/2/10

Thanks,
Rajni Shekhar

Sathiya_Narayanan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sksamantaray on: 3/30/2012 [Member] Silver | Points: 25

Up
0
Down
Hi Try to create a DataView,filter the data and then bind the dataview instead of dataset

Thanks,
Sanjay

Sathiya_Narayanan, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response