Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi guys , thanks for your time .

i want to search between two dates in vb.net (in datagridview) , using
two datetimepicker .

please help me !!
Posted
Updated 14-Jan-21 23:34pm
Comments
Wendelius 12-Aug-15 5:36am    
Please explain in more detail. What is the problem you're facing, search from where, what code you already have and so on.
OriginalGriff 12-Aug-15 6:09am    
Are you using a database, or if not, what?
If so, which?
Member 11903597 12-Aug-15 6:34am    
yes i am using database
(access 2007)

1 solution

"yes i am using database
(access 2007)"


So, just use a query:
VB
Dim dtStart As DateTime = dtpStartDate.Value
Dim dtEnd As DateTime = dtpEndDate.Value
Using cmd As New OleDbCommand("SELECT * FROM MyTable WHERE MyDateColumn BETWEEN @ST AND @EN", con)
    cmd.Parameters.AddWithValue("@ST", dtStart)
    cmd.Parameters.AddWithValue("@EN", dtEnd)
    ...
End Using
 
Share this answer
 
Comments
Member 11903597 12-Aug-15 7:04am    
that didn't work , no action
and i dont want to use "con" word its give me error
do you have another solution
OriginalGriff 12-Aug-15 7:13am    
So let me get this straight:
1) You don't know what the "con" part is, can't guess, and don't want to look in the documentation.
2) You haven't bothered to change the table name to match your DB.
3) You haven't bothered to change the column name to match your DB.
4) All of the above.

Tell me, are you considering development as a career? If so, why?
Maciej Los 13-Aug-15 1:59am    
My virtual 5 for this reply and real 5 for the 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