Reporting Services传递数据集

时间:2016-03-31 19:08:52

标签: sql reporting-services reporting

我在使用使用临时表的proc的报告服务时遇到问题。那么有没有办法从数据表中传入值?我之前可以调用我的proc来构建数据表,然后我想将表作为数据集传入。我该怎么做?

2 个答案:

答案 0 :(得分:0)

Select all the rows in the temp table as your final statement in your stored proc:

SELECT * FROM @TempTable

答案 1 :(得分:0)

我使用以下代码块解决了我的问题。还要注意,报告服务不喜欢proc中的临时表。据我所知,这是一个已知问题,因此上述解决方案无效。

 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