首页 ┆ 网站地图 ┆ 在线留言 ┆ 游戏资讯 ┆ 资源下载  ┆ 端午节祝福 
设为首页
加入收藏
联系我们
热门关键字: .net应用  操作系统  Dreamweaver  WinRAR  网络推广
高级搜索
您当前的位置: 主页>NET专区>报表>.net下对水晶报表的多表显示数据
.net下对水晶报表的多表显示数据
来源: 发布时间:2008-07-14 发布人: 浏览: 人次   字体: [ ]  
有些时候我们用vs做水晶报表开发时,是多个表进行查询。这怎么处理呢,方法如下:

只是在.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这个值必须是表名,所以没有法子,我写了二个。

↓下一篇:没有了
相 关 文 章   发布商链接
·Active Report使用心得之配置iis及we...
·ActiveReport创建报表文件及中文显示...
·ActiveReport通过代码进行动态的数据...
·ActiveReport在WebForm下的显示类型...
·ActiveReport出现"No Report Specifi...
·ActiveRecord中实体类问题解决方法
·ASP.net集成水晶报表的操作
·初学RDLC报表遇到问题的一些总结
·RDLC报表部署遇到的问题及其解决方法
·用友华表Cell控件实现数据xml 构造器...
 §最新评论:(评论内容只代表网友观点,与本站立场无关!)
网名: 验证码:  【所有评论】【↑返回顶部
评 分: 12 345
评论内容:(不能超过500字,请自觉遵守互联网相关政策法规。[按 Ctrl+Enter 可直接提交]
注意:请勿在本站发布政治话题、色情及违反法律的内容。
IT知道网 声明:刊登此文章是为了传递更多信息,文章内容仅供参考,转载请注明出处。
推 荐 文 章
·RDLC报表部署遇到的问题及其...
·初学RDLC报表遇到问题的一些...
·ASP.net集成水晶报表的操作
·ActiveRecord中实体类问题解...
·ActiveReport出现"No Report ...
·ActiveReport在WebForm下的显
·ActiveReport通过代码进行动...
·ActiveReport创建报表文件及...
·Active Report使用心得之配置...
热 门 文 章
·Active Report使用心得之配置...
·ActiveReport在WebForm下的显...
·ActiveReport创建报表文件及...
·ActiveReport通过代码进行动...
·初学RDLC报表遇到问题的一些...
·ActiveReport出现"No Report ...
·RDLC报表部署遇到的问题及其...
·用友华表Cell控件实现数据xml...
·ActiveRecord中实体类问题解...
·ASP.net集成水晶报表的操作
·Win2003打印水晶报表没有权限...
网站首页 - 关于本站 - 加入收藏 - 网站地图 - 友情连接 - 在线留言 - 联系我们 - 返回顶部
Copyright © 2007 IT知道网.[冀ICP备07026896号]. All Rights Reserved .