惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Help Net Security
Help Net Security
G
Google Developers Blog
雷峰网
雷峰网
WordPress大学
WordPress大学
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Engineering at Meta
Engineering at Meta
Security Latest
Security Latest
T
Threat Research - Cisco Blogs
AWS News Blog
AWS News Blog
F
Full Disclosure
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Exploit Database - CXSecurity.com
J
Java Code Geeks
U
Unit 42
C
Cyber Attacks, Cyber Crime and Cyber Security
V
V2EX
C
Cisco Blogs
博客园 - 司徒正美
Project Zero
Project Zero
L
LINUX DO - 热门话题
阮一峰的网络日志
阮一峰的网络日志
Blog — PlanetScale
Blog — PlanetScale
Scott Helme
Scott Helme
A
About on SuperTechFans
Hugging Face - Blog
Hugging Face - Blog
S
Securelist
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏
S
Schneier on Security
G
GRAHAM CLULEY
酷 壳 – CoolShell
酷 壳 – CoolShell
Cyberwarzone
Cyberwarzone
MongoDB | Blog
MongoDB | Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 叶小钗
T
Threatpost
Recorded Future
Recorded Future
C
CXSECURITY Database RSS Feed - CXSecurity.com
宝玉的分享
宝玉的分享
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
The Register - Security
The Register - Security
S
Security Archives - TechRepublic
博客园 - Franky
N
News | PayPal Newsroom
Simon Willison's Weblog
Simon Willison's Weblog
S
SegmentFault 最新的问题
W
WeLiveSecurity
A
Arctic Wolf
B
Blog

博客园 - 我本无名

asp.net中repeater嵌套CheckBoxList,RadioButtonList来完成投票 javascript中setTimeOut 和setInterval的区别 在不同页面之间传递参数 循环不间断显示滚动图片 解决"当前命令发生了严重错误。应放弃任何可能产生的结果。"的问题 - 我本无名 - 博客园 一个不错的,JavaScript代码,显示首页图片幻灯片效果 一个计算数值并进行排序的SQL语句 asp.net上传图片后,在图片上加入自己的背景字 - 我本无名 - 博客园 解决javascript里的中文信息是乱码的问题 javascript特效,信息滚动效果 水晶报表的使用(VS2003+CR9) 关于“响应在此上下文中不可用” 中文VS2008中安装ASP.NET MVC框架,不显示模板 关于split中字符串的问题 OnClientClick的妙用! 一条SQL语句 如何进行软件需求分析 软件需求分析规格说明书格式 (转载)悟透JavaScript
关于水晶报表的多表显示
我本无名 · 2008-04-15 · via 博客园 - 我本无名

有些时候我们做报表,是多个表进行查询。这怎么处理呢。
方法如下:
其它步骤请看前一篇文章
只是在.xsd文件中,多加入一个表,并且将他们相关联

在.aspx文件中代码如下。

            SqlConnection conn = new SqlConnection("server=.;uid=sa;pwd=chen123;database=C_News;");
            conn.Open();
            SqlCommand cmd 
= new SqlCommand("",conn);
            
//cmd.CommandText = "select * from C_Article a left join C_BigClass b on a.BigClass=b.BigClass";
            cmd.CommandText = "select * from C_Article";
            SqlDataAdapter da 
= new SqlDataAdapter();
            da.SelectCommand 
= cmd;
            DataSet ds 
= new DataSet();
            da.Fill(ds,
"DataSet1");
            ds.Tables[
0].TableName = "C_Article";

            cmd.CommandText 
= "select * from C_BigClass";
            SqlDataAdapter da2 
= new SqlDataAdapter();
            da.SelectCommand 
= cmd;
            da.Fill(ds,
"DataSet1");
            ds.Tables[
1].TableName = "C_BigClass";
            
//ds.Tables[0].TableName = "DataSet1";

            CrystalReport1 oCR 
= new CrystalReport1();
            oCR.SetDataSource(ds);
            
this.CrystalReportViewer1.ReportSource = oCR;
            
this.CrystalReportViewer1.DataBind();

            conn.Close();

这里有一个很奇怪的问题,如果我使用left join on把二个表联起来查询。它不好用,因为ds.Tables[1].TableName这个值必须是表名,所以没有法子,我写了二个。
不知道有没有什么好的方法。如果有,请你给我留言,十分感谢

此文章只做为自己的代码备份。