Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parameterized Query
Message
From
21/09/2009 20:42:57
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Parameterized Query
Miscellaneous
Thread ID:
01425528
Message ID:
01425528
Views:
95
First foray into .NET so please be gentle............

Please note: there are extra spaces in the code near the < > tags. UT could not accept the original formatting

Following an example in an online tutorial I have the following code
    < asp:SqlDataSource ID="myFilteringDataSource" runat="server"
        ConnectionString="< %$ ConnectionStrings:RLP_SPOTLIGHTConnectionString % >" 
        ProviderName="< %$ ConnectionStrings:RLP_SPOTLIGHTConnectionString.ProviderName % >" 
        SelectCommand="SELECT DISTINCT buyer_type FROM open_order"
    / >
    < asp:DropDownList ID="myDropDownList" runat="server"
        DataSourceID   = "myFilteringDataSource"
        DataValueField = "buyer_type"
        AutoPostBack   = "True"
     / >

    <br />
    <br />
    < asp:SqlDataSource ID="MySqlOpen_Order" runat="server" 
        ConnectionString="< %$ ConnectionStrings:RLP_SPOTLIGHTConnectionString % >" 
        ProviderName="< %$ ConnectionStrings:RLP_SPOTLIGHTConnectionString.ProviderName % >" 
        SelectCommand="SELECT * FROM open_order">      
    < /asp:SqlDataSource >


    < asp:GridView ID="GridView1" runat="server" DataSourceID="MySqlOpen_Order" 
                             etc
This code works in that both the dropdown list and the grid display properly.

Again based on sample code from the tutorial I've tried to modify the code to have the grid based upon the value of the dropdown
with the modified code as follows
< asp:SqlDataSource ID="MySqlOpen_Order" runat="server" 
     ConnectionString="< %$ ConnectionStrings:RLP_SPOTLIGHTConnectionString % >" 
     ProviderName="< %$ ConnectionStrings:RLP_SPOTLIGHTConnectionString.ProviderName % >" 
     SelectCommand="SELECT * FROM open_order where buyer_type = @buyer_type">      
        
     < SelectParameters>
      < asp:ControlParameter Name="buyer_type" ControlID="myDropDownList" PropertyName="SelectedValue" / >
    < /SelectParameters>
< /asp:SqlDataSource>
When this version of the code runs the dropdown list appears but the grid never gets populated. Selecting a new value from the dropdown doesn't do anything.

All suggestions gratefully appreciated

.........Rich
Next
Reply
Map
View

Click here to load this message in the networking platform