我正在执行SSRS rpt
,需要在包含sqldatasource
id 的网络项目中复制此内容。
ssrs rpt
参数完全可以填充,但是当我尝试在Web版本中完成相同的操作时,第二个参数列表永远不会被填充。
Ship
参数取决于CruiseLine
参数中选择的内容。
网络版中的参数如下:
<tr>
<td>
Select a CruiseLine:
<telerik:radcombobox id="RadComboBox1" runat="server" checkboxes="True" enablecheckallitemscheckbox="False"
skin="Web20" sort="Ascending" allowcustomtext="True" datasourceid="SqlDataSource1"
datatextfield="CruiseLine" datavaluefield="CruiseLine">
</telerik:radcombobox>
<asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator3" ValidationGroup="A"
ControlToValidate="RadComboBox1" ErrorMessage="Choose a CruiseLine!"></asp:RequiredFieldValidator>
</td>
<td>
Select a Ship:
<telerik:radcombobox id="RadComboBox2" runat="server" checkboxes="True" enablecheckallitemscheckbox="False"
skin="Web20" sort="Ascending" allowcustomtext="True" datasourceid="SqlDataSource2"
datatextfield="Ship" datavaluefield="Ship">
</telerik:radcombobox>
<asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator2" ValidationGroup="A"
ControlToValidate="RadComboBox2" ErrorMessage="Choose a Ship!"></asp:RequiredFieldValidator>
</td>
</tr>
以下是相应的SQL数据源:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:PrepaidConnectionString %>"
SelectCommand="SelectCruiseLine" DataSourceMode="DataSet" EnableCaching="true"
SelectCommandType="StoredProcedure"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:PrepaidConnectionString %>"
SelectCommand="SelectShip" DataSourceMode="DataSet" EnableCaching="true" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:Parameter Name="CruiseLine" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
第一个sqldatasource执行以下sql(从存储过程中填充列表没有问题:
SELECT DISTINCT CruiseLine
FROM dbo.ShipProductPrices
ORDER BY CruiseLine
第二个sqldatasource
执行以下sql(也来自存储过程):
ALTER PROCEDURE [dbo].[SelectShip]
@CruiseLine NVARCHAR(MAX)
AS
BEGIN
SET NOCOUNT ON;
SELECT DISTINCT Ship
FROM dbo.ShipProductPrices
WHERE CruiseLine IN (SELECT * FROM dbo.SplitParameterValues(@CruiseLine, ','))
ORDER BY Ship
END
现在,我只是选择了一个cruiseline,我希望当我下载第二个组合框的下拉列表时,它应该运行一个类似于以下内容的查询并填充Ship combobox:
SELECT DISTINCT Ship
FROM dbo.ShipProductPrices
WHERE CruiseLine IN (SELECT * FROM dbo.SplitParameterValues('CCL', ','))
ORDER BY Ship
请注意 Ship combobox
的参数类型以及SelectParameter
的{{1}}的类型。他们有点不同。不知道这是否有所作为。
SelectShip datasource
执行SelectShip SPROC
,它再次成为我在上面运行的UDF
的一部分,数据来自sql management studio。
我需要做些什么来填充第二个sproc
?