Solved

Datetimepicker Dates and SQL Server Format

Posted on 2006-07-19
1
427 Views
Last Modified: 2012-08-14
Hi,

I have a VB application form with two datetimepickers, Datagrid and Button. The user is to select a start date and end date using the datetimepickers. Once selected,  on click of the button a query is sent to the SQL server database table to return entries between these dates and populate the Datagrid with results.

If I select between dates 05/07/2006 and 07/07/2006 - I also get entries starting from 25/05/2006.

There seems to be a problem between dd(days) and MM(months) using dd as MM.

I have the DateTimePickers format set to Custom and CustomFormat as dd/MM/yyyy

Entries in the table being query also follow this format dd/mm/yyyy.

Can anyone tell me what is happening here, I only want entries from the selected dates.

Here is my SQL Command

SELECT * WHERE MdnMaster.ActualDeliveryDate BETWEEN '" & DTP_StartDate.Value & "' AND '" & DTP_EndDate.Value & "'", cn)

 
0
Comment
Question by:daly__paul
[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
1 Comment
 
LVL 34

Accepted Solution

by:
Sancler earned 500 total points
ID: 17139032
.Value is still in MM/dd/yyyy format.  What your custom formatting does is alter what is displayed into dd/MM/yyyy format.  The easiest way is to use DTP_StartDate.Text and DTP_EndDate.Text in your Select command.

Roger
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

688 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