使用水晶报告打印选定的数据网格行 [英] print selected datagrid rows with crystal reports

查看:67
本文介绍了使用水晶报告打印选定的数据网格行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我有一个连接到sql server数据库并将数据添加到数据库的应用程序,我有一个搜索特定记录并将它们显示到数据网格的查询,我想要从datagrig打印只有用户选择的datagrid行,我发现我必须在cr中使用fornula,这里是我找到的代码并添加一些我的。

Hello,
I have an application which connects to an sql server database and adds data to the database, I have a query that searches for specific records and displays them to a datagrid, I want to print from the datagrig only the user selected rows of the datagrid, I found that I must use a fornula in cr, here is the code I have find and add some of mine.

Dim i As New Int32
       Dim rpt As New CrystalReport7()
       i = 0
       rpt.SetDataSource(DataSet31)
       For i = 0 To Me.DataGridView1.SelectedRows.Count
           print.CrystalReportViewer1.SelectionFormula = String.Format("{{me.Table_1.id}} = '{i}'", Me.DataGridView1.SelectedCells(i).Value)
       Next
       print.CrystalReportViewer1.ReportSource = rpt
       print.Show()





但我觉得它不正确,有什么帮助?



but i thing it is not correct, any help?

推荐答案

要传递多个值(是的,这就是你的意思希望),检查这些

使用多值参数为Crystal Reports选择记录 [ ^ ]

打印多个值或范围值的参数选择 [ ^ ]
To pass multiple values(yes, this's what do you want), check these
Using Multiple Value Parameters to Select Records for your Crystal Reports[^]
Printing Parameter Selections for Multiple or Range Values[^]


这篇关于使用水晶报告打印选定的数据网格行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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