ARTICLE

How SqlDataSource control retrieve record based on a QueryString value

Posted by Manish Dwivedi Articles | VB.NET How do I April 19, 2007
This article explains you, how we can get the records on the basis of QueryString value.
 
Reader Level:

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>

share this article :
post comment
 

Hello mister, I need do it by programing in code-behind .cs is it possible ? how i can do it ?greetings

Posted by alhambraeidos May 10, 2007
Nevron Diagram
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Team Foundation Server Hosting
Become a Sponsor