
May 4th, 2004, 03:35 PM
|
|
Registered User
|
|
Join Date: Mar 2004
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
HELP! Date comparison
OK - 'm working with the Calendar control DayRender event. First My code, then the problem:
Code:
privatevoid DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
{
tempDate = e.Day.Date;//Calendar1.TodaysDate;
string selectData = "SELECT Meeting_Title, Meeting_date=convert(datetime,convert(char(10),Mee ting_date,101))FROM Meeting_Profile_tbl";
SqlDataAdapter da = new SqlDataAdapter(selectData, conn2);
DataSet ds = new DataSet();
da.Fill(ds, "Meeting_Profile_tbl");
DataTable dt = ds.Tables["Meeting_Profile_tbl"];
foreach (DataRow dr in dt.Rows)
{
string myDate = dr[1].ToString();-------PROBLEM IS SOMEWHERE IN HERE
if (myDate == tempDate.ToString())
{
e.Cell.Controls.Add(new LiteralControl("Meeting"));
}
}
conn2.Close();
}
I'm getting "myDate" out of SQL and when I bring it in the format of the date is mm/dd/yyyy hh:mm:ss and I am trying to compare it with the DayRendered date which is in mm/dd/yyyy only.
How in the world can I convert the dates to match formats. As you can see from my SELECT statement above, I am trying to convert within the statement but it doesn't work. If anyone can help me through this, I will consider you DA MAN or WOMAN which ever
|