anbuvec
asked on
regarding database filter
i have a database which captures date and time in the following format
08/26/2012 5:58:42 PM
i need to filter all the data created on 08/26/2012
i have a datepicker control in VB
i need to use the datepicker control to select the date which i will be using to filter the data.
how to do that coz if i am using the query "Select * from table where datefield =#" & datepicker1.value & "#"
nothing is returned as it will search for exact value of date picker that would be 08/26/2012 but the actual value of the table is 08/26/2012 5:58:42 PM. how to give the query for filtering this situation. please help
08/26/2012 5:58:42 PM
i need to filter all the data created on 08/26/2012
i have a datepicker control in VB
i need to use the datepicker control to select the date which i will be using to filter the data.
how to do that coz if i am using the query "Select * from table where datefield =#" & datepicker1.value & "#"
nothing is returned as it will search for exact value of date picker that would be 08/26/2012 but the actual value of the table is 08/26/2012 5:58:42 PM. how to give the query for filtering this situation. please help
ASKER
.tostring is not an attribute or function and more over the database field type for date value is date/time field. i have tried the following and it gave me object required error
"Select tablefield from table where datefield between '" & DTPicker1.Value.ToString(" MM DD yyyy") & " 00:00' to '" & DTPicker1.Value.ToString(" MM DD yyyy") & " 23:59'".
"Select tablefield from table where datefield between '" & DTPicker1.Value.ToString("
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
did you can take the date part from the datepicker ?
ASKER
Thank you so much owenacampbell... i was using the like command but i have missed the syntax i was using # instead of ' as that was a date field that is why i wanted to use = instead of like... it is just a syntax... but very quick and thank you for ur response... :D
"Select * from table where datefield between '" & datepicker1.value.ToString