Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 313
  • Last Modified:

Calender Control

How I Create a my own calendar using calender control and using sql databases
0
sdbit6
Asked:
sdbit6
  • 2
2 Solutions
 
zulu_11Commented:
please clarify what is it exactly that you want?
0
 
Ryan ChongCommented:
Try use the Date Time Picker Control? I thought the UI is good enough already..
0
 
TrancedifiedCommented:
There is a control called the DateTimePicker. I assume you are using a date range with the SQL BETWEEN clause.

So make one DateTimePicker your "Start Date" and one your "End Date" Make sure for both of these controls, go to the Value Property and remove the time out of there so there's only a date.

To "use" the datetimepicker w/ a SQL query do something like:

Dim strSQL As String

strSQL = "SELECT * FROM MYTABLE "
strSQL &= "WHERE [My Date Field] BETWEEN " & "'" & DateTimePickerStart.Value & "'" & _
                " AND " & "'" & DateTimePickerEnd.Value & "'"

So the query in plain SQL will look like:

SELECT * FROM MYTABLE WHERE [My Date Field] BETWEEN '4/5/2003' AND '12/31/2004'

That should return all records between those two date ranges.
Notice the "'" & DateTimePickerStart.Value & "'"               is    quote apostrophe quote      like:

"'"
Let me know if that was ok?

Chris
0
 
TrancedifiedCommented:
TheLearnedOne,

Hi Bob, splitting points will be nice since the original author said "....and using sql databases." I just think my example could have been more useful or "thorough." I'm fine either way. Thanks for helping me in my other posts :)


Chris
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now