Click here to Skip to main content
15,879,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

If we use the date time picker to save the date to the access database specific column, and we need to search by this date time picker value for data stored in the database, how could we do this?
date time picker stores the time in addition to the date at the insertion process so this is the point of problem.
Updated 21-Jul-11 20:11pm


See this link How do I make DateTextBox ...if could help...


Share this answer
RaviRanjanKr 22-Jul-11 4:58am    
Nice Link, My 5 :)
The date in the search string should compatible with the sql date column.( else typecast error )
Convert the date into sql suitable format(MM/DD/YY). User Convert.ToDateTime function.
Else split the value from the date time picker using ,
int mon = date.Split(‘/’)[0].ToInt();
int day = date.Split(‘/’)[1].ToInt();
int yr = date.Split(‘/’)[2].ToInt();
and pass the string suitably.
Hope this helps!!!!!!
Share this answer
Is your data stored with time in the database or have you forced it to only have the date and 12:00:00. This determines if you need to use between in your select statement.

Now you need to format your datetime value to either have 12:00:00 as the time or create 2 values to be used in the between statement. This can be done in a number of way including string manipulation, data formatting or it can be done in the database if you are using stored procedures.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900