asp:SqlDataSource

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 " />
 
G

Guest

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top