c# - Sort a DateTime Column with a Calendar -
There is a dateTime
property in the UserLoginPerDay
column in my database It is that I catch that column with some other columns and display it in a grid view on my asp.net website.
Although I have written this statement while writing this statement that I have to input the importance of one time, no one will show the record; I just want to be able to select one day in my calendar and every record that day Must show the equivalent of, ignore time.
I have a SqlDataSource
ASPX page
& asp: calendar id = "calendar 1" runat = "server "Onselectionchanged =" calendar 1_selected "& gt; & Lt; / Asp: Calendar & gt; & Lt; Asp: SqlDataSource id = "SqlDataSource1" runat = "server" connection string = "& lt;% $ connectionSettings: log inproperty%>" SelectCommand = "UserLoginToday.UserId, Gebruikers.Lastname, Gebruikers.Firstname, UserLoginToday.UserLoginPerDay where selection Gebruikers.UserId = Join within Gebruikers UserLoginToday UserLoginToday.UserId (UserLoginToday.UserLoginPerDay = IsNull (@datefilter, UserLoginToday.UserLoginPerDay))" CancelSelectOnNullParameter = "false" & gt; & Lt; SelectParameters & gt; & Lt; Asp: ControlParameter ControlID = "Calendar1" name = "datefilter" property name = "selected date" /> & Lt; / SelectParameters & gt; & Lt; / ASP: SQLDataSource & gt;
The date time contains both the date and time data as long as all the rows in the database As part of time, 0 does not happen and your application sends 0 as part of time, they will never be equal.
If your database has MS SQL Server, then I recommend that you use the function to compare dates. DATEDIFF (DAY, date1, date2) = 0
True if both dates are the same, the time portion of the price.
Comments
Post a Comment