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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top