简体   繁体   English

Reporting Services传入数据集

[英]Reporting Services Pass In Dataset

I'm having issues with reporting services using my proc that uses temp tables. 我在使用临时表的proc中遇到报表服务问题。 So is there a way to pass in the values from a data table? 那么有没有办法传递数据表中的值? I can call my proc before to build a data table and then I want to pass in the table as a data set. 我可以在建立数据表之前调用proc,然后再将表作为数据集传入。 how do I do that? 我怎么做?

选择临时表中的所有行作为存储过程中的最后一条语句:

SELECT * FROM @TempTable

I resolved my issue with the following code block. 我使用以下代码块解决了我的问题。 also note that reporting services does not like temp tables in procs. 还应注意,报表服务不喜欢proc中的临时表。 From what I understand this is a known issue so the above solution would not work. 据我了解,这是一个已知问题,因此上述解决方案将不起作用。

 Private Sub Build_Invoice_Report(ByVal Invoice_Number As Long)
    Try
        Dim Report As String = "Weight.Report2.rdlc"
        Dim Bill_Name As String = "US PIPE"
        Dim Bill_Address_1 As String = "2023 ST. Louis Ave"
        Dim Bill_Address_2 As String = "Bessemer, AL, 35020"

        With Me.Report_Viewer.LocalReport
            .ReportEmbeddedResource = Report
        End With

        dt = DataHelperFunctions.GetInvoiceReport(Invoice_Number, Bill_Name, Bill_Address_1, Bill_Address_2)
        Get_Invoice_ReportBindingSource.DataSource = dt

        'Build Variables
        Commodity = CStr(dt.Rows(0)("Commodity"))
        Vendor = CStr(dt.Rows(0)("Vendor_Name"))
        InvoiceStartDate = CStr(dt.Rows(0)("Start_Date"))
        InvoiceEndDate = CStr(dt.Rows(0)("End_Date"))
    Catch ex As Exception
        Dim methodName = CStr(System.Reflection.MethodBase.GetCurrentMethod().Name)
        Dim ClassName = CStr(Me.GetType().Name)
        DataHelperFunctions.ReportException(methodName, ClassName, CStr(ex.ToString), CStr(System.DateTime.Now))
    End Try
End Sub

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM