如何根据客户端ID创建不同的RDLC报告 [英] How to Create Different RDLC report Based on Client ID

查看:85
本文介绍了如何根据客户端ID创建不同的RDLC报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好...

i我在vb.net中创建报表管理系统,我在我的应用程序中面临新问题,当我选择客户端ID时,特定客户端ID仅详情生成RDLC报告。我想要这样



这是我的数据库表:



Hi All...
i am creating the report management system in vb.net, i am facing the new problem in my application,when i choice the client id, the particular client id Details only generate the RDLC report. i want like this

This is my Database Table:

____________________________________________________
ClientId | ClientName  | Amount  | BalanceAmount
____________________________________________________
1        | xxx         | 5000    | 4000
2        | yyy         | 2000    | 1000
3        | sss         | 3000    | 0
1        | xxx         | 5000    | 2000
1        | xxx         | 5000    | 1000
____________________________________________________





当我选择我的VB.net Windows应用程序中的ClientId 1 ,自动

创建一个如下所示的RDLC报告...





When i choice the ClientId 1 in my VB.net Windows application,the automatically
create a RDLC Report like below...

____________________________________________________
ClientId | ClientName  | Amount  | BalanceAmount
____________________________________________________
1        | xxx         | 5000    | 4000
1        | xxx         | 5000    | 2000
1        | xxx         | 5000    | 1000









请帮助我...今天是我的项目提交日期,但仍未完成此模块,请发送您的想法和代码..



i am try很多方面,但正确的结果不会来

我的代码在下面请检查...





Pls help me... Today is my project submission date,But Still not complete this module,so Send your ideas and codes..

i am try to many way but correct result is not coming
My code is below pls check it...

推荐答案

请试试这个:



它比你的更简单。请添加两个这样的报告:



AllSystemReport.rdl - 报告将显示所有记录

SystemReportFilterByID - 报告参数



步骤1 :(在SystemReportFilterbyID中执行)

- >将查询更改为Select * From [table name],其中ClientID = @ ClientID

- >参数@ClientID将在参数类别中生成

- >你单独运行这个报告,你有类型ClientID



步骤2(在AllSystemReport中做)

righ点击ClientID字段

- >文本框属性。

- >选择行动,

- >选择去报告,

- >指定报告:SystemReportFilterByID

- >添加参数:名称:ClientID值:ClientID



现在您运行或预览订单。您将鼠标移动到ClientID并单击。你将获得带有ClientID的SystemReportFilterByID
Please try this:

It is more simple than yours. Please add two reports like this:

AllSystemReport.rdl - The report will be display all records
SystemReportFilterByID - Parameter of Report

Step 1: (Do in SystemReportFilterbyID)
-> Change the query to Select * From [table name] where ClientID=@ClientID
-> parameter @ClientIDwill be generated in Parameter category
-> You run this report alone, you have type ClientID

Step 2 (Do in AllSystemReport)
righ click ClientID field
-> Text Box Properties.
-> choose action,
-> choose go to report,
-> specify a report : SystemReportFilterByID
-> Add parameter: Name: ClientID Value: ClientID

Now you run or preview order. You move mouse to ClientID and click. you will get the SystemReportFilterByID with ClientID


我以简单的方式解决了这个问题我的代码在下面

i solve this problem in simple way my code is below
Public Sub clientid()
       Dim sqlQRY As String
       Dim reportPath As String = "Company_Reckon_Invoice.Report4.rdlc" 'report viewer path
       Dim sReportDataSource As New ReportDataSource
       sqlQRY = "select invoiceid,Clientid,ClientName,Productname,(SUM(TotalAmount)-Sum(Amountpaid)) as BalanceAmount  from receipt where Clientid=" + TextBox1.Text + " GROUP BY invoiceid,Clientid,Clientname,Productname "
       ds = New DataSet
       clientidd = New OleDbDataAdapter(sqlQRY, conn)
       clientidd.Fill(ds, "receipt") ' receipt = database tabel name
       ReportViewer1.LocalReport.ReportEmbeddedResource = reportPath
       sReportDataSource.Name = "DataSet1" ' DataSet1=datasource name in report viewer
       sReportDataSource.Value = ds.Tables(0)
       ReportViewer1.LocalReport.DataSources.Clear()
       ReportViewer1.LocalReport.DataSources.Add(sReportDataSource)
       Me.ReportViewer1.RefreshReport()
   End Sub





只需在编码窗口的任何地方调用clientid。:)



Just call the clientid in any where in your coding window.:)


我自己做这个程序,但是我收到错误

I do this program myself but i got a error in
"
an error occurred during local report processing the definition of the report 'report1' has not been specified Object reference not set to an instance of an object





我不知道怎么解决这个问题请帮帮我:我的VB.net windows应用程序代码如下:





I don't know how to solve this problem pls help me: My VB.net windows Application code is below:

Imports System.Data.OleDb
Imports Microsoft.Reporting.WinForms
Public Class Form1
    Dim cn As New OleDbConnection("Provider=Microsoft.jet.oledb.4.0;data source=D:\Programs\sathish\invoicedb.mdb")
    Dim cmd As OleDbCommand
    Dim da As OleDbDataAdapter
    Dim ds As DataSet
    Dim sqlQRY As String = ""
    Dim reportPath As String = "Custom Based RDLC Report Generation.Report1.rdlc"
    Dim sReportDataSource As New ReportDataSource
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        Try
            cn.Open()
            MsgBox("connected", MsgBoxStyle.Information)
            sqlQRY = "Select invoiceid,Clientid,Clientname,Productname,Totalamount,BalanceAmount from receipt"
            viewreports()
        Catch ex As Exception
            MsgBox(ex.Message.ToString)
        End Try

    End Sub
    Sub viewreports()
        ds = New DataSet
        da = New OleDbDataAdapter(sqlQRY, cn)
        da.Fill(ds, "receipt")
        ReportViewer1.LocalReport.ReportEmbeddedResource = reportPath
        sReportDataSource.Name = "DataSet1"
        sReportDataSource.Value = ds.Tables(0)
        ReportViewer1.LocalReport.DataSources.Add(sReportDataSource)
        Me.ReportViewer1.RefreshReport()
    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        sqlQRY = "Select invoiceid,Clientid,Clientname,Productname,Totalamount,BalanceAmount from receipt where  Clientid=" & Val(TextBox1.Text)
        viewreports()
    End Sub
End Class







请发送您的想法..




pls send your ideas..


这篇关于如何根据客户端ID创建不同的RDLC报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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