我需要在Request.QueryString
?
asp:SqlDataSource
<asp:SqlDataSource runat="server"
ID="SqlDataSource2" ConnectionString='<%$ ConnectionStrings:messageexchangeConnectionString %>'
ProviderName='<%$ ConnectionStrings:messageexchangeConnectionString.ProviderName %>'
SelectCommand='SELECT distribution_address FROM exchange_distribution_groups ex WHERE (organisation_id = 'Request.QueryString["organisation"]') AND (distribution_address NOT IN (SELECT distribution_address FROM exchange_distribution_group_addresses address))'>
</asp:SqlDataSource>
答案 0 :(得分:2)
您可以使用此
<asp:SqlDataSource runat="server" ID="SqlDataSource2"
ConnectionString='<%$ ConnectionStrings:messageexchangeConnectionString %>'
ProviderName='<%$ ConnectionStrings:messageexchangeConnectionString.ProviderName %>'
SelectCommand='SELECT distribution_address FROM exchange_distribution_groups ex WHERE (organisation_id = '<%# Request.QueryString["organisation"] %> ') AND (distribution_address NOT IN (SELECT distribution_address FROM exchange_distribution_group_addresses address))'>
</asp:SqlDataSource>
答案 1 :(得分:2)
试试这个:
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:messageexchangeConnectionString %>"
SelectCommand="SELECT organisation_id,distribution_address FROM exchange_distribution_groups ex WHERE (([organisation_id] = @id) AND (distribution_address NOT IN (SELECT distribution_address FROM exchange_distribution_group_addresses address))">
<SelectParameters>
<asp:QueryStringParameter Name="id" QueryStringField="organisation" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>