[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Where parameter using just the date part not full datetime

Posted on 2011-03-17
3
Medium Priority
?
637 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

649 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