本文介绍了如何根据客户端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 ,自动

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





When i choice the ClientId 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...

推荐答案


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.:)


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报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 05:09
查看更多