I'm having trouble getting my SqlParameter to work in my SqlDataSource select command. I'm trying to run a query when a new calendar date on a calendar control is selected to filter the query by the date selected. Here's what I have on the C# end:
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
SqlParameter para1 = new SqlParameter("@mydate", SqlDbType.DateTime);
para1.Value = Calendar1.SelectedDate;
SqlDataSource1.SelectParameters.Add(para1);
}
I /almost/ found what I need via this thread: How can I set the sqldatasource parameter's value?
but the solution offered by the top answer gives me the following error for the SelectParameters.Add line: "The best overloaded match ... has some invalid arguments."
How can I fix this error and get the parameter to work in my select query?
Thanks.