双11狂欢大促

盲盒赢 定制羽绒服

开启惊喜盲盒,抽取你的专属好礼

— 惊喜奖品抢先看 —

求助,水晶报表如何调用2个数据库的表

fengyuanqing fengyuanqing 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我在vs2010中做了一个水晶报表,想要调用2个表中的数据,其中一个表是入库单的信息例如:入库时间等
另一个表是入库商品的详细信息例如:货物名称等等。一个入库单对应多个入库商品。
我能将一个表的信息在水晶报表中显示出来,但是另一个表的信息不知道怎么能弄出来
下面是我的代码c#


SqlConnection con = new SqlConnection(conStr);
con.Open();
string sql = string.Format("select * from RuKu ");
SqlDataAdapter ad = new SqlDataAdapter(sql, con);
DataSet1 dt1 = new DataSet1();
ad.Fill(dt1, "mytable");
ReportDocument myreport = new ReportDocument();

string P_str_creportPath = Application.StartupPath.Substring(//得到报表路径信息
0, Application.StartupPath.Substring(0,
Application.StartupPath.LastIndexOf("\\")).LastIndexOf("\\"));
P_str_creportPath += "\\MyCrystalReport.rpt";//添加报表名称
myreport.Load(P_str_creportPath);//加载报表

//myreport.Load(Application.StartupPath + "MyCrystalReport.rpt");
myreport.SetDataSource(dt1);
crystalReportViewer1.ReportSource = myreport;
con.Close();



我这里想请教各位高人几个问题:
1.如何把2个表的信息都能在报表上显示出来
2.怎能令报表能弄成类似下图的效果

还请大家帮帮忙,小弟不胜感谢
...全文

相关推荐

评论 3
收藏 已收藏
分享
返回顶部
fengyuanqing
图表区 4,818 成员 14,133 内容