In c#.net I have the following DataSource setup that I am trying to dynamically assign a WHERE clause to in the code behind...
<asp:LinqDataSource ID="LinqDataSource1" runat="server"
ContextTypeName="MyNameSpace.DataClasses1DataContext"
TableName="MyTableWithADateTimeColumn" >
</asp:LinqDataSource>
The code behind looks something like this...
LinqDataSource1.Where = "MyDateColumn == DateTime(" + DateTime.Now + ")";
This gives me an error of "')' or ',' expected". I've also tried casting it inside quotation marks as well as without casting it as DateTime and with quotation marks...
LinqDataSource1.Where = @"MyDateColumn == """ + DateTime.Now + @""" ";
This gives me "Operator '==' incompatible with operand types 'DateTime' and 'String'". I've tried several other ways but I am obviously missing something here.
Similar code is working fine for strings.