LinqDataSource: Filter between dates
-
Tuesday, March 20, 2012 5:22 PM
Hello,
I hope I am posting in the correct forum.
I am new to Linq. I need to filter between two dates, but it seems is am using an incorrect syntax because I got a variety of errors. How can I add filtering through two dates to the following LinqDataSource like "GetDate() between FromStartDate to EndDate"?
<asp:LinqDataSource ID="LinqDataSource1" runat="server"
ContextTypeName="XYZ.Database.XYZDataContext" OrderBy="MyRowDescription"
Select="new (MyTable_RowId, MyRowDescription as MyRowCD)"
TableName="MyTable" Where="CompanyId == @CompanyId">
<WhereParameters>
<asp:SessionParameter DefaultValue="0" Name="CompanyId" SessionField="CompanyId" Type="Int32" />
</WhereParameters>
</asp:LinqDataSource>- Edited by C a r l o s A n t o n i o Tuesday, March 20, 2012 5:22 PM
- Moved by Alan_chen Tuesday, April 03, 2012 5:13 AM (From:LINQ to SQL)
All Replies
-
Wednesday, March 21, 2012 7:02 AM
Hi CarlosAntonio,
Welcome!
You can refer this link here: http://forums.asp.net/t/1714442.aspx/1 and you should post your question that relates to LinqDataSource here:http://forums.asp.net/54.aspx/1?DataSource+Controls+SqlDataSource+ObjectDataSource+etc
Have a nice day.
Alan Chen[MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.


