水晶报表之子报表数据不能显示问题

tonny688 2011-02-19 05:16:48
各位大哥,我已经使用“数据集”建立两个数据表的结构,并且用fill将两个SQL查询的两个表填充到DataSet里面,但是报表只能显示主报表的数据,却没有显示子报表的数据。请问各位,请问阿泰哥,应该如果修改,问题出在哪里呢?
...全文
198 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
阿双2009 2011-02-21
  • 打赏
  • 举报
回复
你现在子报表置于什么位置?
tonny688 2011-02-21
  • 打赏
  • 举报
回复
在报表页脚。
tonny688 2011-02-20
  • 打赏
  • 举报
回复
想再请教一下,如何在主报表显示子报表的某一两个字段?如果直接拉子报表的字段到主报表,这样会有问题。
例如主报表详细资料有两条记录A ,B
子报表有3条记录1,2,3
那么显示出来的主报表的详细资料变成5条记录。
tonny688 2011-02-20
  • 打赏
  • 举报
回复
对对对,解决了,太感谢您了。
阿双2009 2011-02-19
  • 打赏
  • 举报
回复
怎么代码失效了
阿双2009 2011-02-19
  • 打赏
  • 举报
回复
[code=C]

da.Fill(ds, "rp_project");
da.Fill(ds, "rpdetail");

//这边ds填充了两个Table


cr.SetDataSource(dsFtwo.Tables[0]); //而这边仅仅把ds的第一个表赋给报表

//应该把整个dsFtwo传进去,即
cr.SetDataSource(dsFtwo);


[/code]
tonny688 2011-02-19
  • 打赏
  • 举报
回复
在报表的报表专家界面之“链接”中已经设置wxno与dlrpno按关键字链接,并可看到连线双连
tonny688 2011-02-19
  • 打赏
  • 举报
回复
string sConnectionString;
sConnectionString = " Data Source=TEST;Initial ;User ID=sa;Password=001;server=. ";
SqlConnection Connn = new SqlConnection(sConnectionString);
Connn.Open();

SqlDataAdapter da = new SqlDataAdapter("select * from rp_project where wxno='S20110117001'", Connn);

DataSet ds = new DataSet();
da.Fill(ds, "rp_project");

da = new SqlDataAdapter("select dlrpno,dlspmo,cnname from rpdetail where dlrpno='S20110117001'", Connn);
da.Fill(ds, "rpdetail");

frmprintso pr = new frmprintso();
pr.dsFtwo = ds;

pr.ShowDialog();


*********
private void frmprintso_Load(object sender, System.EventArgs e)
{
DataSet ds1 = new DataSet();
Crprpsh cr = new Crprpsh();
cr.SetDataSource(dsFtwo.Tables[0]);
this.crvprint.ReportSource = cr;
frmreport dr = new frmreport();
}
阿双2009 2011-02-19
  • 打赏
  • 举报
回复
主从表数据进行关联了吗?

贴出相关代码看看吧。。
不使用水晶报表,实现列表式的打印。 刚学C# 1个月时写的,如果污染了视听,请见谅。 struct PageProperty { public int PageLeft; public int PageTop; public int PageBottom; public int PageWidth; public int PageHeight; public int RowSpace; public int ColSpace; public int AllVisibleColSpace; public int AllColWidth; public int AllVisibleColWidth; public int AllRowHeight; public int TitleH; public int SubTitleH; public int FooterH; public int[] ColWidth; public int VisibleColWidth; public int PageTextHeight; public int PageTextWidth; } struct TRect { public int Left; public int Top; public int Right; public int Bottom; } class PanelImage : Panel { protected Panel panelShadow = null; public PictureBox ImgData = null; public PanelImage() { this.BackColor = Color.Gray; this.DoubleBuffered = true; ImgData = new PictureBox(); ImgData.Parent = this; ImgData.BackColor = Color.White; panelShadow = new Panel(); panelShadow.Parent = this; panelShadow.BackColor = Color.Black; ResizeControl(); } void ResizeControl() { panelShadow.Left = 8; panelShadow.Top = 8; panelShadow.Width = this.Width - 12; panelShadow.Height = this.Height - 12; ImgData.Left = 4; ImgData.Top = 4; ImgData.Width = this.Width - 12; ImgData.Height = this.Height - 12; } protected override void OnResize(EventArgs eventargs) { ResizeControl(); base.OnResize(eventargs); } protected override void Dispose(bool disposing) { panelShadow.Dispose(); ImgData.Dispose(); base.Dispose(disposing); } } public partial class PrintGrid { [DllImport("gdi32.dll", EntryPoint = "GetDeviceCaps", CallingConvention = CallingConvention.StdCall)] public static extern int GetDeviceCaps(int Handle, int nIndex); private float _leftMargin = 0; private float _topMargin = 0; private float _rightMargin = 0; private float _bottomMargin = 0; const short HORZSIZE = 4; const short VERTSIZE = 6; const short HORZRES = 8; const short VERTRES = 10; const short PHYSICALOFFSETX = 112; const short PHYSICALOFFSETY = 113; int ixLogPixPerInch; int iyLogPixPerInch; int xLogPixPerInch; int yLogPixPerInch; int FPageIndex; int FPageCount; string FLeftPageFooter; string FRightPageFooter; string FTitle; Font FFont; Font FTitleFont; Font FTextFont; Font FFooterFont; Font FSubTitleFont; int FSubTitleOff; int FLeftPageFooterOff; int FPrintCount; string FSubTitle; bool FHLine; bool FVLine; int FPageTop; int FPageLeft; int FPageRight; int FPageBottom; int FToPage; int FFromPage; bool FPrintPageCount; string FRightSubTitle; bool FExistPrinter; bool FCenterShow; Color FHeaderColor; bool FUseHeaderColor; private int iDX; //水平缩放比例 private int iDY; //垂直缩放比例 private int ColCount; //总列数 private int RowCount; //总行数 private int[] ColWidth; //记录每一列的宽度 private int AllColWidth; //所有列的宽度 private int AllVisibleColWidth; //所有可视列的宽度 private int RowSpace; //行间距 private int ColSpace; //所有可视列间距 private int AllVisibleColSpace; //所有行的间距 private int AllColSpace; //所有列的间距 private int AllRowSpace; //所有行的间距 private int RowsOfPage; //每页打的行数 private int PageWidth; //页的宽度 private int PageHeight; //页的高度 private int PageTextHeight; //页正文高度 private int PageTextWidth; //页正文宽度 private int TextTop; //正文上边距 private int TextLeft; //正文左边距 private int TitleH; //标题高度 private int SubTitleH; //子标题高度 private int FooterH; //页脚高度 private int FooterTop; //页脚顶部 private int TextH; //正文高度 private int VisibleColWidth; private int DX; private int DY; private string StrTest; private ListView ListViewData = null; //数据 private PrintDocument PD = null;

4,816

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 图表区
社区管理员
  • 图表区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧