Reporting Services 传入数据集
Reporting Services Pass In Dataset
我在使用使用临时 tables 的过程报告服务时遇到问题。那么有没有办法从数据 table 中传递值?我可以在构建数据 table 之前调用我的 proc,然后我想将 table 作为数据集传递。我该怎么做?
Select temp table 中的所有行作为存储过程中的最终语句:
SELECT * FROM @TempTable
我使用以下代码块解决了我的问题。另请注意,报告服务不喜欢 procs 中的临时表。据我了解,这是一个已知问题,因此上述解决方案不起作用。
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
我在使用使用临时 tables 的过程报告服务时遇到问题。那么有没有办法从数据 table 中传递值?我可以在构建数据 table 之前调用我的 proc,然后我想将 table 作为数据集传递。我该怎么做?
Select temp table 中的所有行作为存储过程中的最终语句:
SELECT * FROM @TempTable
我使用以下代码块解决了我的问题。另请注意,报告服务不喜欢 procs 中的临时表。据我了解,这是一个已知问题,因此上述解决方案不起作用。
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