i want to check if the date selected is before the today date. if yes, i wish to return a message in the label.
if (Convert.ToDateTime(Calendar1.SelectedDa... = (Convert.ToDateTime(Calendar1.SelectedDa...
{
Label1.Text += "Select date after or today date";
}
another prob is my datediff don't seem to work. anyway MPAnnouncement.date_posted is a column name in my annoncement table.
SELECT MPAnnouncement.announcement, MPAnnouncement.date_posted, MPAnnouncement.subject, MPUser.user_name FROM MPAnnouncement INNER JOIN MPUser ON MPAnnouncement.user_id = MPUser.user_id WHERE (MPAnnouncement.display_to = 'Industry') OR(MPAnnouncement.display_to = 'All') OR (MPAnnouncement.display_to LIKE '%I%') AND (DATEDIFF (d,MPAnnouncement.date_posted,GETDATE())...
thanks
Calendar compare date c#?
Well the answer to your first part is pretty easy. Below is an example of how you can do that...
if (monthCalendar1.SelectionStart %26lt; DateTime.Now) {
MessageBox.Show("Date selected is before now");
}
You would put that into the monthCalendar1's datechanged event so when they select a new date it will run this code.
The second part I am afraid I can't help you with since I would have to know what data types you are using, the error you are getting and the database you are using. From what I see of it it looks ok but the last part is cut off (the part I really need to see).
Hope the first part helps.
dds
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment