报告生成特定人员 [英] Report Generation of an specific person

查看:60
本文介绍了报告生成特定人员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过输入特定人员生成任何详细信息来生成报告...例如:通过在文本框中提供详细信息并将结果显示为

解决方案

它依赖于SQL Query,如下所示:



DECLARE @SearchWord NVARCHAR(MAX)



SELECT DISTINCT

*

来自员工

WHERE

FirstName喜欢'%'+ @ SearchWord +'%'

或LastName LIKE'%'+ @ SearchWord +'%'

或地址LIKE'%'+ @ SearchWord +'%'

OR AnyOtherColumn LIKE' %'+ @ SearchWord +'%'


如果您使用的是Crystal Report,请执行以下步骤



添加Crystal Report参考





在表格中将这些行添加到顶部



 导入 CrystalDecisions。共享 
< span class =code-keyword> Imports CrystalDecisions.CrystalReports.Engine





 私有  Sub  Button2_Click( ByVal  sender 作为系统。对象 ByVal  e  As  System.EventArgs)句柄 Button2.Click 
Dim Rpt 作为 ReportDocument
Dim frmView 作为 frmCRView ' Crystal Report查看器表单
Dim RptName As 字符串 =
RptName = 报告标题

Rpt = Report1 ' 您的Crystal报表名称

frmView.CRViewer1。 SelectionFormula =( {Table1.pt_id} ='&修剪( Me .TextBox1.Text)& '' 如果您需要两个字段,则选择公式只使用此类型({Table1.pt_id} ='& Trim(Me.TextBox1.Text)&'和{Table1.visit_id} ='& Trim(Me.TextBox2.Text)&')
frmView.CRViewer1.ReportSource = Rpt
frmView.CRViewer1.RefreshReport()
frmView .Text = RptName& for patient:& .TextBox1.Text
frmView.Show()
结束 Sub < /跨度>


How to generate a report by entering a specific persons any details...For eg:by providng an detail in an text box and diplaying the result

解决方案

It is dependent on SQL Query like as follows:

DECLARE @SearchWord NVARCHAR(MAX)

SELECT DISTINCT
*
FROM Employee
WHERE
FirstName LIKE '%' + @SearchWord+ '%'
OR LastName LIKE '%' + @SearchWord+ '%'
OR Address LIKE '%' + @SearchWord+ '%'
OR AnyOtherColumn LIKE '%' + @SearchWord+ '%'


If you are using Crystal Report do these steps

Add Crystal Report references


In your form add these lines at top

Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine



Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
       Dim Rpt As New ReportDocument
       Dim frmView As New frmCRView  'Crystal Report viewer form
       Dim RptName As String = ""
       RptName = "Report Title"

       Rpt = New Report1 'Your Crystal Report Name

       frmView.CRViewer1.SelectionFormula = ("{Table1.pt_id}='" & Trim(Me.TextBox1.Text) & "'") 'Your selection formula if you need two fields just use this type ("{Table1.pt_id}='" & Trim(Me.TextBox1.Text) & "' and "{Table1.visit_id}='" & Trim(Me.TextBox2.Text) & "'")
       frmView.CRViewer1.ReportSource = Rpt
       frmView.CRViewer1.RefreshReport()
       frmView.Text = RptName & " for Patient: " & Me.TextBox1.Text
       frmView.Show()
   End Sub


这篇关于报告生成特定人员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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