Link to home
Start Free TrialLog in
Avatar of R8VI
R8VI

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of aibusinesssolutions
aibusinesssolutions
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial