Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working on desktop application using C#.NET and SQL SERVER 2008

if i want to add another table in data set after i created crystal report .Can i modify crystal report and how...
thanx in advance.i want that data should also get displayed of both tables.i Have tried following code
CrystalReport1  objRpt = new CrystalReport1();

            string connString = "Data Source=SW-PC-20;Initial Catalog=PSM;Integrated Security=True";
            SqlConnection Conn = new SqlConnection(connString);
            //SqlDataAdapter adepter = new SqlDataAdapter("select Media_method_ID,Media_Name ,Target_Audience   from Media_Method ", connString);

            SqlDataAdapter adepter = new SqlDataAdapter("select m.Media_method_ID,m.Media_Name ,t.Target_Audience_ID,t.Target_Audience   from Media_Method m,Target_Audience t where m.Media_method_ID=t.Media_method_ID", connString);
            DataSet1 Ds = new DataSet1();
            //
            adepter.Fill(Ds, "Media_Method"+"Target_Audience");

            objRpt.SetDataSource(Ds);
            crystalReportViewer1.ReportSource = objRpt;


regards
Posted
Updated 10-May-11 1:36am
v2

Adding a datable to dataset is not an issue but report will use only one table at a time. So, either merge the two(or more) tables into one or use sub-reports.

For Sub-reports in Crystal report, look here:
Adding a Subreport to the Original Report[^]
Creating Sub-Reports Using Crystal Reports[^]
Create a Subreport in Crystal Reports [^]
 
Share this answer
 
yes, you can.
after adding table into dataset you just have to set datasourse location of that dataset which is you used into the crystal report.
steps are following,
1) add table into dataset
2) into open crystal report go to the field explorer
3) right click on database fields and click on set datasource location
4) in open window you will find 2 different parts 1st is current datasource and another is replace with ..
refresh project data by right click and then just update that dataset which you already used into the crystal report on click of update button displayed on the right hand side.
 
Share this answer
 
Comments
shivani 2013 10-May-11 7:33am    
Thanx for ur answer but i want that data should also get displayed of both the tables
i have updated my question

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900