SqlDataSource control String value using VB.NET

ASP.NET, QueryString, SqlDataSource
  • 2819

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>

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.