locked
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?

    ex..

    <td>

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

    </SelectParameters>
    </asp:SqlDataSource>
    </td>

     

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

    Thanks.

    Tuesday, July 25, 2017 8:48 AM

All replies