当前位置:编程学习 > C#/ASP.NET >>

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

我在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.怎能令报表能弄成类似下图的效果

还请大家帮帮忙,小弟不胜感谢 报表 数据库 sql --------------------编程问答-------------------- 把两个数据库的数据查询到一个数据集DataSet中 --------------------编程问答-------------------- 用父子报表显示,


http://blog.csdn.net/happy09li/article/details/6931959

http://blog.csdn.net/luols/article/details/7037367 --------------------编程问答-------------------- 除
补充:.NET技术 ,  图表区
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,