Reputation: 464
whats the diffrence btw this two SqlDataSource1?
<SelectParameters>
<asp:Parameter Name="user" />
</SelectParameters>
SqlDataSource1.SelectParameters("user").DefaultValue = "some value";
SqlDataSource1.SelectParameters("@param",user);
When i use
SqlDataSource1.SelectParameters("user").DefaultValue = "some value";
it works but
SqlDataSource1.SelectParameters("@param",user);
doesn't:
Upvotes: 2
Views: 10701
Reputation: 2689
In the selecting event of the SqlDataSource control pass the value to the to the parameter:
protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
e.Command.Parameters["@user"].Value="value";
}
Upvotes: 3
Reputation: 983
I think you should use smth. like this:
SqlDataSource1.SelectParameters.Add("@param",user);
that has some overloads.
Upvotes: 0