我正面临着这个相当奇怪的问题,我有两个按钮部分: 1)打印一个项目 2)打印所有项目
当从打印的一个项目部分单击一个按钮时,它会获取一些参数并处理该特定项目的报告
当我尝试相同而没有参数并执行select *时会认为它会返回所有项目,但它只返回一个项目。
打印一件物品
查询用于填充数据集,然后将其用作报告的来源
SELECT [Unit UPC Base Item], [Production Line],
[Production Line Description], [Preset Number],
[Weight Factor], Piece, [Pcs Per Unit],
[Upper Limit Unit], [Upper Limit Factor], [Label Wt (g)],
[Tare Wt (g)], [Constant Tare Wt (g)],
[Pkg Length (mm)], [Film Product Code],
[Film Width (mm)], [Forming Tube (mm)],
[Type of Jaws], [Last Updated],
[Item Description], [MAV (g)], [PieceWeight(g)], UL1, UL2,
UL3,[UpperLimit(g)], [LowerLimit(g)],
[Label Wt (g)] + [Tare Wt (g)] AS [Target Wt (g)]
FROM [Net Weight Master Data Report]
WHERE ([Unit UPC Base Item] = @upc) AND ([Production Line Description] = @prod)
最终报告生成:
以上看起来不错
打印所有项目
查询用于填充数据集,然后将其用作报告的来源
SELECT [Unit UPC Base Item], [Production Line],
[Production Line Description], [Preset Number],
[Weight Factor], Piece, [Pcs Per Unit], [Upper Limit Unit],
[Upper Limit Factor], [Label Wt (g)], [Tare Wt (g)],
[Constant Tare Wt (g)], [Pkg Length (mm)], [Film Product Code],
[Film Width (mm)], [Forming Tube (mm)], [Type of Jaws],
[Last Updated], [Item Description], [MAV (g)], [PieceWeight(g)],
UL1, UL2, UL3, [UpperLimit(g)], [LowerLimit(g)],
[Repair Min Wt (g)]
FROM [Net Weight Master Data Report]
ORDER BY [Unit UPC Base Item]
生成的最终报告
正如您可以看到上面图1中突出显示的部分,它选择了最后一条记录2)它只显示最后一条记录,总共有2327条记录,因此需要创建2327条报告
我无法查看我的查询有什么问题,或者是报告方面的错误。
任何帮助都非常受欢迎!!!!!
修改
用于在报告查看器上显示报告的代码
namespace CorsicanaNetWeightProgram
{
public partial class PrintAllBag : Form
{
public PrintAllBag()
{
InitializeComponent();
}
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();
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void button3_Click(object sender, EventArgs e)
{
reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
}
private void button2_Click(object sender, EventArgs e)
{
reportViewer1.PrintDialog();
}
}
}