如何将多个选定的行从datagrid打印到Crystal报表 [英] how to print multiple selected row from datagrid to crystal report

查看:122
本文介绍了如何将多个选定的行从datagrid打印到Crystal报表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

向所有专家问好,我这里有一个大问题,当我选择1行时,我想从我的datagridview中打印数据.没有问题,但是当我尝试打印多行时,只是最后选择的行出现了
这是代码:

Hi to all experts, i have a big problem here, i want to print data from my datagridview, when i select 1 row.. there is no problem, but when i try to print multiple row, just last selected row apear
here is the code :

private void button4_Click(object sender, EventArgs e)
        {
            ReportDocument report = new ReportDocument();
            report.Load("katalogbarang.rpt");
            if (Kodetxt.Text == "")
            {

            }
            else
            {
                report.RecordSelectionFormula = "{katalog.id}= " + dg1.SelectedRows[0].Cells[9].Value + "";
            }
            PrintReport rpt = new PrintReport();
            rpt.crystalReportViewer1.ReportSource = report;
            rpt.crystalReportViewer1.Refresh();
            rpt.ShowDialog();
        }



这是我的小状况

-------------------------------------------
| kodebarang | namabarang | jumlah | harga |
-------------------------------------------
| 0121 | kolor | 3 | 2000 |
| 0892 |潘奇| 1 | 10000 |
| 9200 | kutang | 2 | 20000 |
| 8989 | cangcut | 8 | 2500 |
| 7890 | sapu | 1 | 3000 |
-------------------------------------------

当我选择一行(单击鼠标左键)时

| 0121 | kolor | 3 | 2000 |

或当我随机单击(在条件下我只单击一行)时,没有问题,
然后我随机选择了多个行,但仅在我单击的第一行中出现在水晶报表中

我想在水晶报告中报告像这样

| 9200 | kutang | 2 | 20000 |
| 0892 |潘奇| 1 | 10000 |



| 7890 | sapu | 1 | 3000 |
| 0121 | kolor | 3 | 2000 |
| 9200 | kutang | 2 | 20000 |

请有人帮我...给我一些代码和教程来解决我的问题
在此先感谢



this is my little condition

-------------------------------------------
|kodebarang | namabarang | jumlah | harga |
-------------------------------------------
|0121 | kolor | 3 | 2000 |
|0892 | panci | 1 | 10000 |
|9200 | kutang | 2 | 20000 |
|8989 | cangcut | 8 | 2500 |
|7890 | sapu | 1 | 3000 |
-------------------------------------------

when im selecting one row (left click)

|0121 | kolor | 3 | 2000 |

or when i randomly click (in condition i just click one row) there is no problem,
then i chose randomly and more than just one row, but which appear in crystal report only the first i click

i want report in my crystal report are like this

|9200 | kutang | 2 | 20000 |
|0892 | panci | 1 | 10000 |

or

|7890 | sapu | 1 | 3000 |
|0121 | kolor | 3 | 2000 |
|9200 | kutang | 2 | 20000 |

please someone help me... give me some code and tutorial to resolve my prob
thanks in advance

推荐答案

我等待了三天,但没人能回答我发布的问题

好伤心.
i was waiting for 3 days, but no one could reply for my problem posting

so sad..


这篇关于如何将多个选定的行从datagrid打印到Crystal报表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆