I have a dropdown of dates which is a controlparameter(@Provider_Date) used in a sqldatasource query.
WHERE (convert(varchar,Provider_Day.Provider_Date,103) = convert(varchar,@Provider_Date,103).
The trouble I am having is to craft the dropdown of dates(sorted by date,today plus 10 days forward), so that the value of the dropdown works in the SQL Server dateformat agnostic query above, and is sorted properely and is minus the time component in the dropdown.
The code I have is:
DimcFowardate as sorteddictionary(of date,string)
Dim today As New DateTime(Now.Year, Now.Month, (Now.Day))
For Counter As Integer = 0 To 10
Dim dt As New DateTime(DateTime.Now.AddDays(Counter).Year, DateTime.Now.AddDays(Counter).Month, DateTime.Now.AddDays(Counter).Day)
dcFowardDates.Add(FormatDateTime(DateTime.Now.AddDays(Counter), vbShortDate), FormatDateTime(DateTime.Now.AddDays(Counter), vbShortDate))
Next
drpFowardDates..DataSource = dcFowardDates
drpFowardDates..DataTextField = "key"
drpFowardDates..DataValueField = "value"
drpFowardDates.DataBind()
The risk with keeping an open mind is having your brains fall out.
Shaunk
WHERE (convert(varchar,Provider_Day.Provider_Date,103) = convert(varchar,@Provider_Date,103).
The trouble I am having is to craft the dropdown of dates(sorted by date,today plus 10 days forward), so that the value of the dropdown works in the SQL Server dateformat agnostic query above, and is sorted properely and is minus the time component in the dropdown.
The code I have is:
DimcFowardate as sorteddictionary(of date,string)
Dim today As New DateTime(Now.Year, Now.Month, (Now.Day))
For Counter As Integer = 0 To 10
Dim dt As New DateTime(DateTime.Now.AddDays(Counter).Year, DateTime.Now.AddDays(Counter).Month, DateTime.Now.AddDays(Counter).Day)
dcFowardDates.Add(FormatDateTime(DateTime.Now.AddDays(Counter), vbShortDate), FormatDateTime(DateTime.Now.AddDays(Counter), vbShortDate))
Next
drpFowardDates..DataSource = dcFowardDates
drpFowardDates..DataTextField = "key"
drpFowardDates..DataValueField = "value"
drpFowardDates.DataBind()
The risk with keeping an open mind is having your brains fall out.
Shaunk