locked
Using a Querystring value with an AccessDatasource Control and a Gridview RRS feed

  • Question

  • User-908232760 posted

    I'm just not understanding how you link a griview, AccessDataSource and a Querystring variable.

    1. I can get the value of the querystring. 

    2. I can define the AccessDataSource 

    3. I can see and understand the SelectCommand

    I just don't know how to attach the querystring value to the SelectCommand. 

     

    This works:

     

            SelectCommand= "SELECT Nomination.Nominee_F_Name, Nomination.Nominee_L_Name, Nomination.ID, Nomination.Nominee_Has_Responded, Awards.Award_Nm, Awards.Award_ID FROM (AWARDS INNER JOIN Nomination ON AWARDS.Award_ID = Nomination.Award_ID) WHERE Nomination.Award_ID = 2">

    This doesn't:

     

            SelectCommand= "SELECT Nomination.Nominee_F_Name, Nomination.Nominee_L_Name, Nomination.ID, Nomination.Nominee_Has_Responded, Awards.Award_Nm, Awards.Award_ID FROM (AWARDS INNER JOIN Nomination ON AWARDS.Award_ID = Nomination.Award_ID) WHERE Nomination.Award_ID = ' "  & Award_ID: & " ' ">

     

    Where Award_ID is defined in the page load as

    Dim Award_ID as Int16

    Award_ID = Request.QueryString.Item("Award_ID")

     

    At least that's how I used to do it in classic ASP. 

     

    What am I missing to make this gridview dynamic?

    Thursday, March 5, 2009 4:44 PM

Answers

  • User-1199946673 posted

    You don't need any code behind [:)]

    SelectCommand= "SELECT Nomination.Nominee_F_Name, Nomination.Nominee_L_Name, Nomination.ID, Nomination.Nominee_Has_Responded, Awards.Award_Nm, Awards.Award_ID FROM (AWARDS INNER JOIN Nomination ON AWARDS.Award_ID = Nomination.Award_ID) WHERE Nomination.Award_ID = ? ">
    <asp:QueryStringParameter QueryStringField="Award_ID" Type="Int16" />

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 5, 2009 6:55 PM

All replies

  • User-1199946673 posted

    You don't need any code behind [:)]

    SelectCommand= "SELECT Nomination.Nominee_F_Name, Nomination.Nominee_L_Name, Nomination.ID, Nomination.Nominee_Has_Responded, Awards.Award_Nm, Awards.Award_ID FROM (AWARDS INNER JOIN Nomination ON AWARDS.Award_ID = Nomination.Award_ID) WHERE Nomination.Award_ID = ? ">
    <asp:QueryStringParameter QueryStringField="Award_ID" Type="Int16" />

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 5, 2009 6:55 PM
  • User-908232760 posted

     Thank you. That makes life much easier.

     

    Jef

    Friday, March 6, 2009 5:17 AM