Pergunta 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>


All Replies