Hello all,
I am using c#.net. Thanks in advance for any help.
I am using a Repeater and a ObjectDataSource. I use LINQ to connect to the database. This requires a parameter to be passed through (used within the WHERE clause)
public IQueryable<comments> GetComments(DateTime todaysDate)
{
return (from c in dc.comments
where displayDate.Date == todayDate.Date
select c);
}
I am encounting the error above and don't know why. Here is where the problem lies:
<asp:Parameter DefaultValue="<%=Convert.ToDateTime(DateTime.Now)%>" Name="todayDate" Type="DateTime" />
If I provide a actual date it works. For example:
<asp:Parameter DefaultValue="02/09/2009" Name="todayDate" Type="DateTime" />
I have also tried the following and recieved the same error:
DateTime.Now.Date
Datetime.Now
Datetime.Today
Datetime.Now.ToString
Datetime.Now.Date.ToString.
What am I doing wrong?
Thanks
Clare