M
MasterChief
I have a calendar control that I am using to have a person select a
date. Then I connect to a database and I want to display anything that
is equal to that date or where the date selected is atleast between the
start date and end date. I just don't know how I am suppose to get this
to work in SQL. Here is my code
Dim selectedDate As String =
cldrEvents.SelectedDate.ToString("d")
Dim sqlConnectionString As String
sqlConnectionString =
ConfigurationManager.ConnectionStrings("eventsConnectionString").ConnectionString.ToString
Dim sqlConnection As New SqlConnection(sqlConnectionString)
This below is the part I don't understand. I want selectedDate to be
compared between events_startdate and events_enddate. If the
selectedDate is between or equal to the events_starttime and
events_endtime then display the event. How do I get this to happen?
Should I be converting selectedDate to a DateTime object before putting
it into the the sql command?
Dim sqlCommand As New SqlCommand("", sqlConnection)
sqlConnection.Open()
Dim sqlReader As SqlDataReader = SqlCommand.ExecuteReader()
gdvEvents.DataSource = sqlReader
gdvEvents.DataBind()
date. Then I connect to a database and I want to display anything that
is equal to that date or where the date selected is atleast between the
start date and end date. I just don't know how I am suppose to get this
to work in SQL. Here is my code
Dim selectedDate As String =
cldrEvents.SelectedDate.ToString("d")
Dim sqlConnectionString As String
sqlConnectionString =
ConfigurationManager.ConnectionStrings("eventsConnectionString").ConnectionString.ToString
Dim sqlConnection As New SqlConnection(sqlConnectionString)
This below is the part I don't understand. I want selectedDate to be
compared between events_startdate and events_enddate. If the
selectedDate is between or equal to the events_starttime and
events_endtime then display the event. How do I get this to happen?
Should I be converting selectedDate to a DateTime object before putting
it into the the sql command?
Dim sqlCommand As New SqlCommand("", sqlConnection)
sqlConnection.Open()
Dim sqlReader As SqlDataReader = SqlCommand.ExecuteReader()
gdvEvents.DataSource = sqlReader
gdvEvents.DataBind()