How to use where clause in sql datasource RRS feed

  • Question

  • User2017388348 posted

    I want to configure sqldatasource as per dropdownlist ,i want to execute where clause. how to do that?



    <asp:DropDownList ID="ddlBName" runat="server" CssClass="input" DataTextField="BUName" DataValueField="BUId" Height="20px" Width="265px" DataSourceID="SqlDataSource1" OnDataBound="ddlBUName_DataBound" ValidationGroup="bum">
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DBDocumentLibraryConnectionString %>" SelectCommand="SELECT [BUName], [BUId] FROM [VUserRoles] WHERE ([Role] = ?)">
    <asp:QueryStringParameter QueryStringField="Role" Name="Role" />



    I want to exexute as simple sql query like "SELECT EmpId,Name FROM VUserRoles WHERE Role='BU Head' "


    Tuesday, July 25, 2017 8:48 AM

All replies