Solved

Where parameter using just the date part not full datetime

Posted on 2011-03-17
3
621 Views
Last Modified: 2013-11-11
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
Comment
Question by:Sheritlw
  • 2
3 Comments
 
LVL 74

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 35156876
Try:
Where="UserID == @UserID &amp;&amp; SchedStartDateTime.Date == @SchedStartDateTime">

Open in new window

0
 

Author Comment

by:Sheritlw
ID: 35157391
Thanks, that was nice and easy.
0
 
LVL 74

Expert Comment

by:käµfm³d 👽
ID: 35157432
NP. Glad to help  = )
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now