sql data source pass a variable, c#, asp.net

Hi I have the follwoing code

in aspx page

  <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:LiveConnectionString %>"
        SelectCommand="select commentsleftby, comments from ratingsandcomments where Video_ID = @videoid ">
        <SelectParameters>
          <asp:parameter name="videoid" defaultvalue ="" />
          </SelectParameters>

    </asp:SqlDataSource>

c# page

protected void _data_Selecting(object sender, SqlDataSourceSelectingEventArgs
    e)
    {

        e.Command.Parameters["videoid"].Value = Request.QueryString["Video"].ToString();
    }

what i want to do is get the value from the query string and pass it into the datasource

what am i doing wrong

thanks,

R8VI
R8VIAsked:
Who is Participating?
 
aibusinesssolutionsCommented:
Set the parameter in the form_load

SqlDataSource1.SelectParameters["videoid"].DefaultValue = Request.QueryString["video"].ToString()
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.