简体   繁体   中英

Reporting Services Pass In Dataset

I'm having issues with reporting services using my proc that uses temp tables. 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. 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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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