• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 641
  • Last Modified:

Where parameter using just the date part not full datetime

Hi EE,

I have a gridview that is bound to a linqdatasource.  I need to retrieve records based on the date only of a datetime field.  
I've have a hidden field that stores the date I need to filter by.
How do I create a where parameter that only grabs the date?

Thanks,

<asp:LinqDataSource ID="lnqSchedules" runat="server"                ContextTypeName="Service2020.SalonDataClassesDataContext" EnableDelete="True" EnableInsert="True" EnableUpdate="True"  OrderBy="SchedStartDateTime, CustomerID" TableName="Schedules" 
Where="UserID == @UserID &amp;&amp; SchedStartDateTime == @SchedStartDateTime">
<WhereParameters>
<asp:SessionParameter DbType="Guid" Name="UserID" SessionField="UserID" />
<asp:ControlParameter ControlID="hiCalendar" Name="SchedStartDateTime"  PropertyName="Value" Type="DateTime" />
</WhereParameters>
 </asp:LinqDataSource>

Open in new window

0
Sheritlw
Asked:
Sheritlw
  • 2
1 Solution
 
käµfm³d 👽Commented:
Try:
Where="UserID == @UserID &amp;&amp; SchedStartDateTime.Date == @SchedStartDateTime">

Open in new window

0
 
SheritlwAuthor Commented:
Thanks, that was nice and easy.
0
 
käµfm³d 👽Commented:
NP. Glad to help  = )
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now