?
Solved

Where parameter using just the date part not full datetime

Posted on 2011-03-17
3
Medium Priority
?
634 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 2000 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 75

Expert Comment

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

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

777 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