在报告中插入 table 时,所有记录都会被填充,但文本框中的相同数据不会填充所有记录?

When Inserting a table in a report all records get populated but the same data in a text box does not populate all records?

我正在设计一个报告,首先这个报告是通过 GUI idk 生成的,如果这会有什么不同,我通过向导设计了一个新报告,而不是将该报告附加到报告查看器,最后得到这个代码:

 private void PrintAllBag_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'corsicanaNetWeightDataSet11.Net_Weight_Master_Data_Report1' table. You can move, or remove it, as needed.
            this.Net_Weight_Master_Data_Report1TableAdapter.Fill(this.corsicanaNetWeightDataSet11.Net_Weight_Master_Data_Report1);

            this.reportViewer1.RefreshReport();

        }

我用来填充数据集的查询是:

SELECT        TOP (100) PERCENT [Net Weight Master Data].[Unit UPC Base Item], [Net Weight Master Data].[Production Line], [Production Lines].[Production Line Description], 
                         [Net Weight Master Data].[Preset Number], [Net Weight Master Data].[Weight Factor], [Net Weight Master Data].Piece, [Net Weight Master Data].[Pcs Per Unit], 
                         [Net Weight Master Data].[Upper Limit Unit], [Net Weight Master Data].[Upper Limit Factor], [Net Weight Master Data].[Label Wt (g)], 
                         [Net Weight Master Data].[Tare Wt (g)], [Net Weight Master Data].[Constant Tare Wt (g)], [Net Weight Master Data].[Pkg Length (mm)], 
                         [Net Weight Master Data].[Film Product Code], [Net Weight Master Data].[Film Width (mm)], [Net Weight Master Data].[Forming Tube (mm)], 
                         [Net Weight Master Data].[Type of Jaws], [Net Weight Master Data].[Last Updated], [Maximum Allowable Variations].[MAV (g)], 
                         CASE WHEN [Upper Limit Unit] != 'g' THEN ([Label Wt (g)] / [Pcs Per Unit]) END AS [PieceWeight(g)], 
                         ([Maximum Allowable Variations].[MAV (g)] - [Production Lines].[Scale Deviation Factor] - [Net Weight Master Data].[Tare Variation Factor (g)]) 
                         / NULLIF ([Net Weight Master Data].[Weight Factor], 0) AS UL1, 
                         ([Maximum Allowable Variations].[MAV (g)] - [Production Lines].[Scale Deviation Factor] - [Net Weight Master Data].[Tare Variation Factor (g)]) 
                         / NULLIF ([Net Weight Master Data].[Weight Factor], 0) 
                         - CAST(([Maximum Allowable Variations].[MAV (g)] - [Production Lines].[Scale Deviation Factor] - [Net Weight Master Data].[Tare Variation Factor (g)]) 
                         / NULLIF ([Net Weight Master Data].[Weight Factor], 0) AS Int) AS UL2, CASE WHEN [Package Type] IS NOT NULL 
                         THEN ([mav (g)] - [scale deviation factor] - [tare variation factor (g)]) / NULLIF ([weight factor], 0) 
                         WHEN (dbo.[Maximum Allowable Variations].[MAV (g)] - dbo.[Production Lines].[Scale Deviation Factor] - dbo.[Net Weight Master Data].[Tare Variation Factor (g)]) 
                         / NULLIF (dbo.[Net Weight Master Data].[Weight Factor], 0) 
                         - CAST((dbo.[Maximum Allowable Variations].[MAV (g)] - dbo.[Production Lines].[Scale Deviation Factor] - dbo.[Net Weight Master Data].[Tare Variation Factor (g)]) 
                         / NULLIF (dbo.[Net Weight Master Data].[Weight Factor], 0) AS Int) 
                         = 0 THEN CAST((dbo.[Maximum Allowable Variations].[MAV (g)] - dbo.[Production Lines].[Scale Deviation Factor] - dbo.[Net Weight Master Data].[Tare Variation Factor (g)])
                          / NULLIF (dbo.[Net Weight Master Data].[Weight Factor], 0) AS Int) 
                         WHEN (dbo.[Maximum Allowable Variations].[MAV (g)] - dbo.[Production Lines].[Scale Deviation Factor] - dbo.[Net Weight Master Data].[Tare Variation Factor (g)]) 
                         / NULLIF (dbo.[Net Weight Master Data].[Weight Factor], 0) 
                         - CAST((dbo.[Maximum Allowable Variations].[MAV (g)] - dbo.[Production Lines].[Scale Deviation Factor] - dbo.[Net Weight Master Data].[Tare Variation Factor (g)]) 
                         / NULLIF (dbo.[Net Weight Master Data].[Weight Factor], 0) AS Int) > 0 AND 
                         (dbo.[Maximum Allowable Variations].[MAV (g)] - dbo.[Production Lines].[Scale Deviation Factor] - dbo.[Net Weight Master Data].[Tare Variation Factor (g)]) 
                         / NULLIF (dbo.[Net Weight Master Data].[Weight Factor], 0) 
                         - CAST((dbo.[Maximum Allowable Variations].[MAV (g)] - dbo.[Production Lines].[Scale Deviation Factor] - dbo.[Net Weight Master Data].[Tare Variation Factor (g)]) 
                         / NULLIF (dbo.[Net Weight Master Data].[Weight Factor], 0) AS Int) 
                         < 0.51 THEN CAST((dbo.[Maximum Allowable Variations].[MAV (g)] - dbo.[Production Lines].[Scale Deviation Factor] - dbo.[Net Weight Master Data].[Tare Variation Factor (g)])
                          / NULLIF (dbo.[Net Weight Master Data].[Weight Factor], 0) AS Int) 
                         + [Rounding Factor1] ELSE CAST((dbo.[Maximum Allowable Variations].[MAV (g)] - dbo.[Production Lines].[Scale Deviation Factor] - dbo.[Net Weight Master Data].[Tare Variation Factor (g)])
                          / NULLIF (dbo.[Net Weight Master Data].[Weight Factor], 0) AS Int) + [Rounding Factor2] END AS UL3, 
                         CASE WHEN [package type] = 'Bar' THEN 10 WHEN [upper limit unit] != 'g' THEN ([label wt (g)] / [pcs per unit]) * ([upper limit factor]) 
                         WHEN [upper limit unit] = 'g' THEN CASE WHEN [package type] IS NOT NULL THEN ([mav (g)] - [scale deviation factor] - [tare variation factor (g)]) 
                         / NULLIF ([weight factor], 0) 
                         WHEN (dbo.[maximum allowable variations].[mav (g)] - dbo.[production lines].[scale deviation factor] - dbo.[net weight master data].[tare variation factor (g)]) 
                         / NULLIF (dbo.[net weight master data].[weight factor], 0) 
                         - CAST((dbo.[maximum allowable variations].[mav (g)] - dbo.[production lines].[scale deviation factor] - dbo.[net weight master data].[tare variation factor (g)]) 
                         / NULLIF (dbo.[net weight master data].[weight factor], 0) AS INT) 
                         = 0 THEN CAST((dbo.[maximum allowable variations].[mav (g)] - dbo.[production lines].[scale deviation factor] - dbo.[net weight master data].[tare variation factor (g)]) 
                         / NULLIF (dbo.[net weight master data].[weight factor], 0) AS INT) 
                         WHEN (dbo.[maximum allowable variations].[mav (g)] - dbo.[production lines].[scale deviation factor] - dbo.[net weight master data].[tare variation factor (g)]) 
                         / NULLIF (dbo.[net weight master data].[weight factor], 0) 
                         - CAST((dbo.[maximum allowable variations].[mav (g)] - dbo.[production lines].[scale deviation factor] - dbo.[net weight master data].[tare variation factor (g)]) 
                         / NULLIF (dbo.[net weight master data].[weight factor], 0) AS INT) > 0 AND 
                         (dbo.[maximum allowable variations].[mav (g)] - dbo.[production lines].[scale deviation factor] - dbo.[net weight master data].[tare variation factor (g)]) 
                         / NULLIF (dbo.[net weight master data].[weight factor], 0) 
                         - CAST((dbo.[maximum allowable variations].[mav (g)] - dbo.[production lines].[scale deviation factor] - dbo.[net weight master data].[tare variation factor (g)]) 
                         / NULLIF (dbo.[net weight master data].[weight factor], 0) AS INT) 
                         < 0.51 THEN CAST((dbo.[maximum allowable variations].[mav (g)] - dbo.[production lines].[scale deviation factor] - dbo.[net weight master data].[tare variation factor (g)])
                          / NULLIF (dbo.[net weight master data].[weight factor], 0) AS INT) 
                         + [rounding factor1] ELSE CAST((dbo.[maximum allowable variations].[mav (g)] - dbo.[production lines].[scale deviation factor] - dbo.[net weight master data].[tare variation factor (g)])
                          / NULLIF (dbo.[net weight master data].[weight factor], 0) AS INT) + [rounding factor2] END * ([weight factor]) END AS [UpperLimit(g)], 
                         CASE WHEN [upper limit unit] = 'g' THEN CASE WHEN [package type] IS NOT NULL THEN ([mav (g)] - [scale deviation factor] - [tare variation factor (g)]) 
                         / NULLIF ([weight factor], 0) 
                         WHEN (dbo.[maximum allowable variations].[mav (g)] - dbo.[production lines].[scale deviation factor] - dbo.[net weight master data].[tare variation factor (g)]) 
                         / NULLIF (dbo.[net weight master data].[weight factor], 0) 
                         - CAST((dbo.[maximum allowable variations].[mav (g)] - dbo.[production lines].[scale deviation factor] - dbo.[net weight master data].[tare variation factor (g)]) 
                         / NULLIF (dbo.[net weight master data].[weight factor], 0) AS INT) 
                         = 0 THEN CAST((dbo.[maximum allowable variations].[mav (g)] - dbo.[production lines].[scale deviation factor] - dbo.[net weight master data].[tare variation factor (g)]) 
                         / NULLIF (dbo.[net weight master data].[weight factor], 0) AS INT) 
                         WHEN (dbo.[maximum allowable variations].[mav (g)] - dbo.[production lines].[scale deviation factor] - dbo.[net weight master data].[tare variation factor (g)]) 
                         / NULLIF (dbo.[net weight master data].[weight factor], 0) 
                         - CAST((dbo.[maximum allowable variations].[mav (g)] - dbo.[production lines].[scale deviation factor] - dbo.[net weight master data].[tare variation factor (g)]) 
                         / NULLIF (dbo.[net weight master data].[weight factor], 0) AS INT) > 0 AND 
                         (dbo.[maximum allowable variations].[mav (g)] - dbo.[production lines].[scale deviation factor] - dbo.[net weight master data].[tare variation factor (g)]) 
                         / NULLIF (dbo.[net weight master data].[weight factor], 0) 
                         - CAST((dbo.[maximum allowable variations].[mav (g)] - dbo.[production lines].[scale deviation factor] - dbo.[net weight master data].[tare variation factor (g)]) 
                         / NULLIF (dbo.[net weight master data].[weight factor], 0) AS INT) 
                         < 0.51 THEN CAST((dbo.[maximum allowable variations].[mav (g)] - dbo.[production lines].[scale deviation factor] - dbo.[net weight master data].[tare variation factor (g)])
                          / NULLIF (dbo.[net weight master data].[weight factor], 0) AS INT) 
                         + [rounding factor1] ELSE CAST((dbo.[maximum allowable variations].[mav (g)] - dbo.[production lines].[scale deviation factor] - dbo.[net weight master data].[tare variation factor (g)])
                          / NULLIF (dbo.[net weight master data].[weight factor], 0) AS INT) + [rounding factor2] END * ([weight factor]) END AS [LowerLimit(g)], 
                         CASE WHEN [Package Type] = 'Bar' THEN ([Net Weight Master Data].[Label Wt (g)]) - ([Maximum Allowable Variations].[MAV (g)]) 
                         + ([Net Weight Master Data].[Tare Wt (g)]) 
                         WHEN dbo.[Net Weight Master Data].[Package Type] = '10 Pack' THEN [Label Wt (g)] - [MAV (g)] + [tare Wt (g)] + 2.5 ELSE [Label Wt (g)] - [Maximum Allowable Variations].[MAV (g)]
                          + [tare Wt (g)] + 5 END AS [Repair Min Wt (g)], ItemDesc.[Item Description]
FROM            [Net Weight Master Data] LEFT OUTER JOIN
                         [Production Lines] ON [Net Weight Master Data].[Production Line] = [Production Lines].[Production Line] INNER JOIN
                         [Maximum Allowable Variations] ON [Net Weight Master Data].[Label Wt (g)] = [Maximum Allowable Variations].[Labeled Quantity (g)] LEFT OUTER JOIN
                         ItemDesc ON [Net Weight Master Data].[Unit UPC Base Item] = ItemDesc.[Unit UPC Base Item]
ORDER BY [Net Weight Master Data].[Unit UPC Base Item], [Net Weight Master Data].[Production Line]

如您所见,我正在执行 select 全部并且数据集中没有涉及任何参数,但我的报告仍然只显示第一条记录,我不确定这是否是 reportviewer 的限制或报表设计器,我可以在哪里修改以便报表显示所有记录。总共有2373条记录,我只想点击顶部的导航痛苦然后继续下一步

我的表格图片请点击这里link

非常感谢任何帮助,thnks!!!

假设 [Net Weight Master Data] table 中有 2373 条记录,那么很可能是您查询中的 INNER JOIN 限制了结果。尝试从您的查询中删除 INNER JOIN 并再次 运行 它。在您的问题中没有更多上下文,很难给出比这更具体的答案。

我还建议从您那里删除 TOP (100) PERCENT SELECT,因为它不会在您的查询中执行任何操作。

我有一个类似的问题,我在 Whosebug 的帮助下解决了这个问题,所以就像你在你的问题中所说的那样,报告中的 table 能够重复所有记录,但不能重复文本框,你可以按照以下步骤完成您的任务:

  1. 确保您已为报告定义了数据集。
  2. 向报表添加 "Table" 控件。这似乎是迭代数据集中的行所必需的。
  3. 从 table 中删除 header 行和两个默认列,这样您就只剩下一行和一列了。
  4. 将 table 扩展到布局的宽度,并使其达到 "free form" 布局所需的高度。
  5. 默认情况下,table 单元格内有一个文本框。 Right-click 空 table 单元格并选择 "delete" 删除该文本框。
  6. 将 "Rectangle" 控件拖到空的 table 单元格中。它似乎自动 "dock" 到 table 单元格的 width/height。
  7. 现在您应该能够将数据集中的字段(文本框等)拖到矩形中以生成所需的布局。

希望这对您有所帮助:)