asp:SqlDataSource

  • Thread starter Thread starter Jon Paal
  • Start date Start date
J

Jon Paal

how does a querystring value get passed to the selectcommand statement of an asp:SqlDataSource?

<asp:SqlDataSource id="propertyDataSource" Runat="Server"
ConnectionString="<%$ ConnectionStrings:myConnectionString %>"
SelectCommand="SELECT * FROM [Properties] WHERE propertyid = @id " />
 
Hi John,

Throughout SelectParameters collection:

<asp:SqlDataSource ID="propertyDataSource" runat="Server"
ConnectionString="<%$ ConnectionStrings:myConnectionString %>"
SelectCommand="SELECT * FROM [Properties] WHERE propertyid = @id">
<SelectParameters>
<asp:QueryStringParameter DefaultValue="0" Name="@id"
QueryStringField="id" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
 
Back
Top