创建Crystal Report后,可以在数据集中添加另一个表吗? [英] Can another table be added in data set after i created crystal report ?

查看:42
本文介绍了创建Crystal Report后,可以在数据集中添加另一个表吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用C#.NET和SQL SERVER 2008开发桌面应用程序.

如果要在创建水晶报表后在数据集中添加另一个表,是否可以修改水晶报表以及如何...
提前thanx.我希望同时显示两个表中的数据.i尝试了以下代码

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

推荐答案

向数据集中添加datable并不是问题,但是报表一次只能使用一个表.因此,可以将两个(或多个)表合并为一个表或使用子报表.

有关Crystal报表中的子报表,请单击此处:
将子报表添加到原始报表中 [使用Crystal报表创建子报表 [ ^ ]
在Crystal Reports中创建子报表 [
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 [^]


是的,可以.
在将表添加到数据集中后,您只需要设置该数据集的数据源位置即可,将其用于水晶报表中.
步骤如下,
1)将表添加到数据集
2)进入打开的水晶报告去现场浏览器
3)右键单击数据库字段,然后单击设置数据源位置
4)在打开的窗口中,您将找到2个不同的部分,第一个是当前数据源,另一个是用..
替换 右键单击刷新项目数据,然后单击右侧显示的更新按钮,将已使用的数据集更新到水晶报表中.
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.


这篇关于创建Crystal Report后,可以在数据集中添加另一个表吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆