ARTICLE
How SqlDataSource control retrieve record based on a QueryString value
This article explains you, how we can get the records on the basis of QueryString value.
To get the record on the basis of QueryString, we will place the "Where Clause" in the SqlDataSource under the SelectCommand field. We filter the data from the data source on the basis of QueryString value.
In the given example I am filtering the student record on the basis of Student ID and the value of StudentID I am passing through QueryStringField "SID".
<asp:SqlDataSource ID="SDSStudentRecord" runat="server" ConnectionString="<%$ ConnectionStrings:StudentRecord %>"
SelectCommand="SELECT StudentID,StudentName,Father's Name,Section FROM
Student WHERE StudentID = @SID">
<SelectParameters>
<asp:QueryStringParameter Name="SID" QueryStringField="SID" />
</SelectParameters>
</asp:SqlDataSource>